One Click Demo Import - Version 2.3.0

Version Description

Release Date - 28 May 2017

  • Add preview button option to the predefined demo import items,
  • Add custom JS event trigger when the import process is completed,
  • Add custom filter for plugin page title,
  • Remove content import as a required import. Now you can make separate imports for customizer, widgets or redux options.
  • Fix custom menu widgets imports, the menus will now be set correctly.
Download this release

Release Info

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

Code changes from version 2.2.1 to 2.3.0

assets/css/main.css CHANGED
@@ -185,10 +185,39 @@ h4.ocdi__gl-item-title {
185
  margin: 6px 0 0 0;
186
  }
187
 
 
 
 
 
188
  .ocdi__gl-item-button {
189
  float: right;
190
  }
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  .ocdi__gl-header {
193
  display: inline-block;
194
  width: calc(100% - 40px);
185
  margin: 6px 0 0 0;
186
  }
187
 
188
+ .ocdi__gl-item-footer--with-preview h4.ocdi__gl-item-title {
189
+ width: calc(100% - 140px);
190
+ }
191
+
192
  .ocdi__gl-item-button {
193
  float: right;
194
  }
195
 
196
+ .ocdi__gl-item-button + .ocdi__gl-item-button {
197
+ margin-right: 5px;
198
+ }
199
+
200
+ @media (max-width: 782px) {
201
+ h4.ocdi__gl-item-title,
202
+ .ocdi__gl-item-footer--with-preview h4.ocdi__gl-item-title {
203
+ width: 100%;
204
+ margin-bottom: 10px;
205
+ }
206
+
207
+ .ocdi__gl-item-button {
208
+ width: calc(50% - 10px);
209
+ margin-bottom: 10px;
210
+ }
211
+
212
+ .ocdi__gl-item-button + .ocdi__gl-item-button {
213
+ float: left;
214
+ }
215
+
216
+ .ocdi__gl-item-footer {
217
+ height: 72px;
218
+ }
219
+ }
220
+
221
  .ocdi__gl-header {
222
  display: inline-block;
223
  width: calc(100% - 40px);
assets/js/main.js CHANGED
@@ -310,6 +310,9 @@ jQuery( function ( $ ) {
310
  else if ( 'undefined' !== typeof response.message ) {
311
  $( '.js-ocdi-ajax-response' ).append( '<p>' + response.message + '</p>' );
312
  $( '.js-ocdi-ajax-loader' ).hide();
 
 
 
313
  }
314
  else {
315
  $( '.js-ocdi-ajax-response' ).append( '<div class="notice notice-error is-dismissible"><p>' + response + '</p></div>' );
310
  else if ( 'undefined' !== typeof response.message ) {
311
  $( '.js-ocdi-ajax-response' ).append( '<p>' + response.message + '</p>' );
312
  $( '.js-ocdi-ajax-loader' ).hide();
313
+
314
+ // Trigger custom event, when OCDI import is complete.
315
+ $( document ).trigger( 'ocdiImportComplete' );
316
  }
317
  else {
318
  $( '.js-ocdi-ajax-response' ).append( '<div class="notice notice-error is-dismissible"><p>' + response + '</p></div>' );
inc/Helpers.php CHANGED
@@ -44,7 +44,7 @@ class Helpers {
44
  * @return boolean
45
  */
46
  private static function is_import_file_info_format_correct( $import_file_info ) {
47
- if ( ( empty( $import_file_info['import_file_url'] ) && empty( $import_file_info['local_import_file'] ) ) || empty( $import_file_info['import_file_name'] ) ) {
48
  return false;
49
  }
50
 
@@ -59,8 +59,13 @@ class Helpers {
59
  * @return array|WP_Error array of paths to the downloaded files or WP_Error object with error message.
60
  */
61
  public static function download_import_files( $import_file_info ) {
62
- $downloaded_files = array();
63
- $downloader = new Downloader();
 
 
 
 
 
64
 
65
  // ----- Set content file path -----
66
  // Check if 'import_file_url' is not defined. That would mean a local file.
@@ -68,17 +73,6 @@ class Helpers {
68
  if ( file_exists( $import_file_info['local_import_file'] ) ) {
69
  $downloaded_files['content'] = $import_file_info['local_import_file'];
70
  }
71
- else {
72
- return new \WP_Error(
73
- 'url_or_local_file_not_defined',
74
- sprintf(
75
- __( '"import_file_url" or "local_import_file" for %s%s%s are not defined!', 'pt-ocdi' ),
76
- '<strong>',
77
- $import_file_info['import_file_name'],
78
- '</strong>'
79
- )
80
- );
81
- }
82
  }
83
  else {
84
  // Set the filename string for content import file.
@@ -424,7 +418,12 @@ class Helpers {
424
  */
425
  public static function process_uploaded_files( $uploaded_files, $log_file_path ) {
426
  // Variable holding the paths to the uploaded files.
427
- $selected_import_files = array();
 
 
 
 
 
428
 
429
  // Upload settings to disable form and type testing for AJAX uploads.
430
  $upload_overrides = array(
@@ -438,18 +437,23 @@ class Helpers {
438
  $customizer_file_info = wp_handle_upload( $_FILES['customizer_file'], $upload_overrides );
439
  $redux_file_info = wp_handle_upload( $_FILES['redux_file'], $upload_overrides );
440
 
441
- if ( empty( $content_file_info['file'] ) || isset( $content_file_info['error'] ) ) {
442
- // Write error to log file and send an AJAX response with the error.
443
- self::log_error_and_send_ajax_response(
444
- __( 'Please upload XML file for content import. If you want to import widgets or customizer settings only, please use Widget Importer & Exporter or the Customizer Export/Import plugin.', 'pt-ocdi' ),
 
 
 
 
 
 
 
 
445
  $log_file_path,
446
- esc_html__( 'Upload files', 'pt-ocdi' )
447
  );
448
  }
449
 
450
- // Set uploaded content file.
451
- $selected_import_files['content'] = $content_file_info['file'];
452
-
453
  // Process widget import file.
454
  if ( $widget_file_info && ! isset( $widget_file_info['error'] ) ) {
455
  // Set uploaded widget file.
@@ -550,7 +554,7 @@ class Helpers {
550
  __( 'Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = %4$s%1$sCustomizer file = %5$s%1$sRedux files:%1$s%6$s', 'pt-ocdi' ),
551
  PHP_EOL,
552
  get_site_url(),
553
- $selected_import_files['content'],
554
  empty( $selected_import_files['widgets'] ) ? esc_html__( 'not defined!', 'pt-ocdi' ) : $selected_import_files['widgets'],
555
  empty( $selected_import_files['customizer'] ) ? esc_html__( 'not defined!', 'pt-ocdi' ) : $selected_import_files['customizer'],
556
  empty( $redux_file_string ) ? esc_html__( 'not defined!', 'pt-ocdi' ) : $redux_file_string
44
  * @return boolean
45
  */
46
  private static function is_import_file_info_format_correct( $import_file_info ) {
47
+ if ( empty( $import_file_info['import_file_name'] ) ) {
48
  return false;
49
  }
50
 
59
  * @return array|WP_Error array of paths to the downloaded files or WP_Error object with error message.
60
  */
61
  public static function download_import_files( $import_file_info ) {
62
+ $downloaded_files = array(
63
+ 'content' => '',
64
+ 'widgets' => '',
65
+ 'customizer' => '',
66
+ 'redux' => '',
67
+ );
68
+ $downloader = new Downloader();
69
 
70
  // ----- Set content file path -----
71
  // Check if 'import_file_url' is not defined. That would mean a local file.
73
  if ( file_exists( $import_file_info['local_import_file'] ) ) {
74
  $downloaded_files['content'] = $import_file_info['local_import_file'];
75
  }
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
  else {
78
  // Set the filename string for content import file.
418
  */
419
  public static function process_uploaded_files( $uploaded_files, $log_file_path ) {
420
  // Variable holding the paths to the uploaded files.
421
+ $selected_import_files = array(
422
+ 'content' => '',
423
+ 'widgets' => '',
424
+ 'customizer' => '',
425
+ 'redux' => '',
426
+ );
427
 
428
  // Upload settings to disable form and type testing for AJAX uploads.
429
  $upload_overrides = array(
437
  $customizer_file_info = wp_handle_upload( $_FILES['customizer_file'], $upload_overrides );
438
  $redux_file_info = wp_handle_upload( $_FILES['redux_file'], $upload_overrides );
439
 
440
+ // Process content import file.
441
+ if ( $content_file_info && ! isset( $content_file_info['error'] ) ) {
442
+ // Set uploaded content file.
443
+ $selected_import_files['content'] = $content_file_info['file'];
444
+ }
445
+ else {
446
+ // Add this error to log file.
447
+ $log_added = self::append_to_file(
448
+ sprintf(
449
+ __( 'Content file was not uploaded. Error: %s', 'pt-ocdi' ),
450
+ $widget_file_info['error']
451
+ ),
452
  $log_file_path,
453
+ esc_html__( 'Upload files' , 'pt-ocdi' )
454
  );
455
  }
456
 
 
 
 
457
  // Process widget import file.
458
  if ( $widget_file_info && ! isset( $widget_file_info['error'] ) ) {
459
  // Set uploaded widget file.
554
  __( 'Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = %4$s%1$sCustomizer file = %5$s%1$sRedux files:%1$s%6$s', 'pt-ocdi' ),
555
  PHP_EOL,
556
  get_site_url(),
557
+ empty( $selected_import_files['content'] ) ? esc_html__( 'not defined!', 'pt-ocdi' ) : $selected_import_files['content'],
558
  empty( $selected_import_files['widgets'] ) ? esc_html__( 'not defined!', 'pt-ocdi' ) : $selected_import_files['widgets'],
559
  empty( $selected_import_files['customizer'] ) ? esc_html__( 'not defined!', 'pt-ocdi' ) : $selected_import_files['customizer'],
560
  empty( $redux_file_string ) ? esc_html__( 'not defined!', 'pt-ocdi' ) : $redux_file_string
inc/ImportActions.php CHANGED
@@ -26,6 +26,36 @@ class ImportActions {
26
 
27
  // After full import action.
28
  add_action( 'pt-ocdi/after_all_import_execution', array( $this, 'after_import_action' ), 10, 3 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
 
31
 
26
 
27
  // After full import action.
28
  add_action( 'pt-ocdi/after_all_import_execution', array( $this, 'after_import_action' ), 10, 3 );
29
+
30
+ // Special widget import cases.
31
+ if ( apply_filters( 'pt_ocdi/enable_custom_menu_widget_ids_fix', true ) ) {
32
+ add_action( 'pt-ocdi/widget_settings_array', array( $this, 'fix_custom_menu_widget_ids' ) );
33
+ }
34
+ }
35
+
36
+
37
+ /**
38
+ * Change the menu IDs in the custom menu widgets in the widget import data.
39
+ * This solves the issue with custom menu widgets not having the correct (new) menu ID, because they
40
+ * have the old menu ID from the export site.
41
+ *
42
+ * @param array $widget The widget settings array.
43
+ */
44
+ public function fix_custom_menu_widget_ids( $widget ) {
45
+ // Skip (no changes needed), if this is not a custom menu widget.
46
+ if ( ! array_key_exists( 'nav_menu', $widget ) || empty( $widget['nav_menu'] ) || ! is_int( $widget['nav_menu'] ) ) {
47
+ return $widget;
48
+ }
49
+
50
+ // Get import data, with new menu IDs.
51
+ $ocdi = OneClickDemoImport::get_instance();
52
+ $content_import_data = $ocdi->importer->get_importer_data();
53
+ $term_ids = $content_import_data['mapping']['term_id'];
54
+
55
+ // Set the new menu ID for the widget.
56
+ $widget['nav_menu'] = $term_ids[ $widget['nav_menu'] ];
57
+
58
+ return $widget;
59
  }
60
 
61
 
inc/OneClickDemoImport.php CHANGED
@@ -23,7 +23,7 @@ class OneClickDemoImport {
23
  *
24
  * @var object
25
  */
26
- private $importer;
27
 
28
  /**
29
  * The resulting page's hook_suffix, or false if the user does not have the capability required.
@@ -78,7 +78,7 @@ class OneClickDemoImport {
78
  /**
79
  * Returns the *Singleton* instance of this class.
80
  *
81
- * @return PT_One_Click_Demo_Import the *Singleton* instance.
82
  */
83
  public static function get_instance() {
84
  if ( null === static::$instance ) {
@@ -280,10 +280,12 @@ class OneClickDemoImport {
280
  }
281
 
282
  /**
283
- * 3). Import content.
284
  * Returns any errors greater then the "warning" logger level, that will be displayed on front page.
285
  */
286
- $this->append_to_frontend_error_messages( $this->importer->import_content( $this->selected_import_files['content'] ) );
 
 
287
 
288
  /**
289
  * 4). Execute the actions hooked to the 'pt-ocdi/after_content_import_execution' action:
23
  *
24
  * @var object
25
  */
26
+ public $importer;
27
 
28
  /**
29
  * The resulting page's hook_suffix, or false if the user does not have the capability required.
78
  /**
79
  * Returns the *Singleton* instance of this class.
80
  *
81
+ * @return OneClickDemoImport the *Singleton* instance.
82
  */
83
  public static function get_instance() {
84
  if ( null === static::$instance ) {
280
  }
281
 
282
  /**
283
+ * 3). Import content (if the content XML file is set for this import).
284
  * Returns any errors greater then the "warning" logger level, that will be displayed on front page.
285
  */
286
+ if ( ! empty( $this->selected_import_files['content'] ) ) {
287
+ $this->append_to_frontend_error_messages( $this->importer->import_content( $this->selected_import_files['content'] ) );
288
+ }
289
 
290
  /**
291
  * 4). Execute the actions hooked to the 'pt-ocdi/after_content_import_execution' action:
languages/pt-ocdi.pot CHANGED
@@ -58,23 +58,19 @@ msgid ""
58
  "%6$s."
59
  msgstr ""
60
 
61
- #: inc/Helpers.php:75
62
- msgid "\"import_file_url\" or \"local_import_file\" for %s%s%s are not defined!"
63
- msgstr ""
64
-
65
- #: inc/Helpers.php:203 inc/Helpers.php:246
66
  msgid ""
67
  "An error occurred while writing file to your server! Tried to write a file "
68
  "to: %s%s."
69
  msgstr ""
70
 
71
- #: inc/Helpers.php:280
72
  msgid ""
73
  "An error occurred while reading a file from your server! Tried reading file "
74
  "from path: %s%s."
75
  msgstr ""
76
 
77
- #: inc/Helpers.php:303
78
  msgid ""
79
  "This WordPress page does not have %sdirect%s write file access. This plugin "
80
  "needs it in order to save the demo import xml file to the upload directory "
@@ -85,73 +81,71 @@ msgstr ""
85
  msgid "One Click Demo Import"
86
  msgstr ""
87
 
88
- #: inc/Helpers.php:315 inc/OneClickDemoImport.php:132
89
  msgid "Import Demo Data"
90
  msgstr ""
91
 
92
- #: inc/Helpers.php:327
93
  msgid ""
94
  "An error occurred while retrieving reading/writing permissions to your "
95
  "server (could not retrieve WP filesystem credentials)!"
96
  msgstr ""
97
 
98
- #: inc/Helpers.php:335
99
  msgid "Your WordPress login credentials don't allow to use WP_Filesystem!"
100
  msgstr ""
101
 
102
- #: inc/Helpers.php:375
103
  msgid "One Click Demo Import - "
104
  msgstr ""
105
 
106
- #: inc/Helpers.php:409
107
  msgid ""
108
  "%sYour user role isn't high enough. You don't have permission to import "
109
  "demo data.%s"
110
  msgstr ""
111
 
112
- #: inc/Helpers.php:444
113
- msgid ""
114
- "Please upload XML file for content import. If you want to import widgets or "
115
- "customizer settings only, please use Widget Importer & Exporter or the "
116
- "Customizer Export/Import plugin."
117
  msgstr ""
118
 
119
- #: inc/Helpers.php:446 inc/Helpers.php:466 inc/Helpers.php:483
120
- #: inc/Helpers.php:494 inc/Helpers.php:514 inc/Helpers.php:522
121
  msgid "Upload files"
122
  msgstr ""
123
 
124
- #: inc/Helpers.php:462
125
  msgid "Widget file was not uploaded. Error: %s"
126
  msgstr ""
127
 
128
- #: inc/Helpers.php:479
129
  msgid "Customizer file was not uploaded. Error: %s"
130
  msgstr ""
131
 
132
- #: inc/Helpers.php:492
133
  msgid "Missing Redux option name! Please also enter the Redux option name!"
134
  msgstr ""
135
 
136
- #: inc/Helpers.php:510
137
  msgid "Redux file was not uploaded. Error: %s"
138
  msgstr ""
139
 
140
- #: inc/Helpers.php:520
141
  msgid "The import files were successfully uploaded!"
142
  msgstr ""
143
 
144
- #: inc/Helpers.php:546
145
  msgid "Initial max execution time = %s"
146
  msgstr ""
147
 
148
- #: inc/Helpers.php:550
149
  msgid ""
150
  "Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = "
151
  "%4$s%1$sCustomizer file = %5$s%1$sRedux files:%1$s%6$s"
152
  msgstr ""
153
 
154
- #: inc/Helpers.php:554 inc/Helpers.php:555 inc/Helpers.php:556
 
155
  msgid "not defined!"
156
  msgstr ""
157
 
@@ -195,19 +189,19 @@ msgstr ""
195
  msgid "No import files specified!"
196
  msgstr ""
197
 
198
- #: inc/OneClickDemoImport.php:382
199
  msgid ""
200
  "Just used One Click Demo Import plugin and it was awesome! Thanks "
201
  "@ProteusThemes! #OCDI https://www.proteusthemes.com/"
202
  msgstr ""
203
 
204
- #: inc/OneClickDemoImport.php:385
205
  msgid ""
206
  "%1$s%6$sWasn't this a great One Click Demo Import experience?%7$s Created "
207
  "and maintained by %3$sProteusThemes%4$s. %2$s%5$sClick to Tweet!%4$s%8$s"
208
  msgstr ""
209
 
210
- #: inc/OneClickDemoImport.php:398
211
  msgid ""
212
  "%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
213
  "check your page and make sure that everything has imported correctly. If it "
@@ -215,7 +209,7 @@ msgid ""
215
  "it has done its job.%5$s"
216
  msgstr ""
217
 
218
- #: inc/OneClickDemoImport.php:409
219
  msgid ""
220
  "%1$sThe demo import has finished, but there were some import "
221
  "errors.%2$sMore details about the errors can be found in this %3$s%5$slog "
58
  "%6$s."
59
  msgstr ""
60
 
61
+ #: inc/Helpers.php:197 inc/Helpers.php:240
 
 
 
 
62
  msgid ""
63
  "An error occurred while writing file to your server! Tried to write a file "
64
  "to: %s%s."
65
  msgstr ""
66
 
67
+ #: inc/Helpers.php:274
68
  msgid ""
69
  "An error occurred while reading a file from your server! Tried reading file "
70
  "from path: %s%s."
71
  msgstr ""
72
 
73
+ #: inc/Helpers.php:297
74
  msgid ""
75
  "This WordPress page does not have %sdirect%s write file access. This plugin "
76
  "needs it in order to save the demo import xml file to the upload directory "
81
  msgid "One Click Demo Import"
82
  msgstr ""
83
 
84
+ #: inc/Helpers.php:309 inc/OneClickDemoImport.php:132
85
  msgid "Import Demo Data"
86
  msgstr ""
87
 
88
+ #: inc/Helpers.php:321
89
  msgid ""
90
  "An error occurred while retrieving reading/writing permissions to your "
91
  "server (could not retrieve WP filesystem credentials)!"
92
  msgstr ""
93
 
94
+ #: inc/Helpers.php:329
95
  msgid "Your WordPress login credentials don't allow to use WP_Filesystem!"
96
  msgstr ""
97
 
98
+ #: inc/Helpers.php:369
99
  msgid "One Click Demo Import - "
100
  msgstr ""
101
 
102
+ #: inc/Helpers.php:403
103
  msgid ""
104
  "%sYour user role isn't high enough. You don't have permission to import "
105
  "demo data.%s"
106
  msgstr ""
107
 
108
+ #: inc/Helpers.php:449
109
+ msgid "Content file was not uploaded. Error: %s"
 
 
 
110
  msgstr ""
111
 
112
+ #: inc/Helpers.php:453 inc/Helpers.php:470 inc/Helpers.php:487
113
+ #: inc/Helpers.php:498 inc/Helpers.php:518 inc/Helpers.php:526
114
  msgid "Upload files"
115
  msgstr ""
116
 
117
+ #: inc/Helpers.php:466
118
  msgid "Widget file was not uploaded. Error: %s"
119
  msgstr ""
120
 
121
+ #: inc/Helpers.php:483
122
  msgid "Customizer file was not uploaded. Error: %s"
123
  msgstr ""
124
 
125
+ #: inc/Helpers.php:496
126
  msgid "Missing Redux option name! Please also enter the Redux option name!"
127
  msgstr ""
128
 
129
+ #: inc/Helpers.php:514
130
  msgid "Redux file was not uploaded. Error: %s"
131
  msgstr ""
132
 
133
+ #: inc/Helpers.php:524
134
  msgid "The import files were successfully uploaded!"
135
  msgstr ""
136
 
137
+ #: inc/Helpers.php:550
138
  msgid "Initial max execution time = %s"
139
  msgstr ""
140
 
141
+ #: inc/Helpers.php:554
142
  msgid ""
143
  "Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = "
144
  "%4$s%1$sCustomizer file = %5$s%1$sRedux files:%1$s%6$s"
145
  msgstr ""
146
 
147
+ #: inc/Helpers.php:557 inc/Helpers.php:558 inc/Helpers.php:559
148
+ #: inc/Helpers.php:560
149
  msgid "not defined!"
150
  msgstr ""
151
 
189
  msgid "No import files specified!"
190
  msgstr ""
191
 
192
+ #: inc/OneClickDemoImport.php:384
193
  msgid ""
194
  "Just used One Click Demo Import plugin and it was awesome! Thanks "
195
  "@ProteusThemes! #OCDI https://www.proteusthemes.com/"
196
  msgstr ""
197
 
198
+ #: inc/OneClickDemoImport.php:387
199
  msgid ""
200
  "%1$s%6$sWasn't this a great One Click Demo Import experience?%7$s Created "
201
  "and maintained by %3$sProteusThemes%4$s. %2$s%5$sClick to Tweet!%4$s%8$s"
202
  msgstr ""
203
 
204
+ #: inc/OneClickDemoImport.php:400
205
  msgid ""
206
  "%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
207
  "check your page and make sure that everything has imported correctly. If it "
209
  "it has done its job.%5$s"
210
  msgstr ""
211
 
212
+ #: inc/OneClickDemoImport.php:411
213
  msgid ""
214
  "%1$sThe demo import has finished, but there were some import "
215
  "errors.%2$sMore details about the errors can be found in this %3$s%5$slog "
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: 2.2.1
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.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: 2.3.0
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: capuderg, cyman, Prelc
3
  Tags: import, content, demo, data, widgets, settings, redux, theme options
4
  Requires at least: 4.0.0
5
- Tested up to: 4.7
6
- Stable tag: 2.2.1
7
  License: GPLv3 or later
8
 
9
  Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
@@ -89,6 +89,7 @@ function ocdi_import_files() {
89
  ),
90
  'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image1.jpg',
91
  'import_notice' => __( 'After you import this demo, you will have to setup the slider separately.', 'your-textdomain' ),
 
92
  ),
93
  array(
94
  'import_file_name' => 'Demo Import 2',
@@ -108,13 +109,14 @@ function ocdi_import_files() {
108
  ),
109
  'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image2.jpg',
110
  'import_notice' => __( 'A special note for this import.', 'your-textdomain' ),
 
111
  ),
112
  );
113
  }
114
  add_filter( 'pt-ocdi/import_files', 'ocdi_import_files' );
115
  `
116
 
117
- You can set content import, widgets, customizer and Redux framework import files. You can also define a preview image, which will be used only when multiple demo imports are defined, so that the user will see the difference between imports. Categories can be assigned to each demo import, so that they can be filtered easily.
118
 
119
  = How to automatically assign "Front page", "Posts page" and menu locations after the importer is done? =
120
 
@@ -163,6 +165,7 @@ function ocdi_import_files() {
163
  ),
164
  'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image1.jpg',
165
  'import_notice' => __( 'After you import this demo, you will have to setup the slider separately.', 'your-textdomain' ),
 
166
  ),
167
  array(
168
  'import_file_name' => 'Demo Import 2',
@@ -182,6 +185,7 @@ function ocdi_import_files() {
182
  ),
183
  'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image2.jpg',
184
  'import_notice' => __( 'A special note for this import.', 'your-textdomain' ),
 
185
  ),
186
  );
187
  }
@@ -340,6 +344,16 @@ Please visit this [docs page](https://github.com/proteusthemes/one-click-demo-im
340
 
341
  == Changelog ==
342
 
 
 
 
 
 
 
 
 
 
 
343
  = 2.2.1 =
344
 
345
  *Release Date - 3 April 2017*
2
  Contributors: capuderg, cyman, Prelc
3
  Tags: import, content, demo, data, widgets, settings, redux, theme options
4
  Requires at least: 4.0.0
5
+ Tested up to: 4.8
6
+ Stable tag: 2.3.0
7
  License: GPLv3 or later
8
 
9
  Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
89
  ),
90
  'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image1.jpg',
91
  'import_notice' => __( 'After you import this demo, you will have to setup the slider separately.', 'your-textdomain' ),
92
+ 'preview_url' => 'http://www.your_domain.com/my-demo-1',
93
  ),
94
  array(
95
  'import_file_name' => 'Demo Import 2',
109
  ),
110
  'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image2.jpg',
111
  'import_notice' => __( 'A special note for this import.', 'your-textdomain' ),
112
+ 'preview_url' => 'http://www.your_domain.com/my-demo-2',
113
  ),
114
  );
115
  }
116
  add_filter( 'pt-ocdi/import_files', 'ocdi_import_files' );
117
  `
118
 
119
+ You can set content import, widgets, customizer and Redux framework import files. You can also define a preview image, which will be used only when multiple demo imports are defined, so that the user will see the difference between imports. Categories can be assigned to each demo import, so that they can be filtered easily. The preview URL will display the "Preview" button in the predefined demo item, which will open this URL in a new tab and user can view how the demo site looks like.
120
 
121
  = How to automatically assign "Front page", "Posts page" and menu locations after the importer is done? =
122
 
165
  ),
166
  'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image1.jpg',
167
  'import_notice' => __( 'After you import this demo, you will have to setup the slider separately.', 'your-textdomain' ),
168
+ 'preview_url' => 'http://www.your_domain.com/my-demo-1',
169
  ),
170
  array(
171
  'import_file_name' => 'Demo Import 2',
185
  ),
186
  'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image2.jpg',
187
  'import_notice' => __( 'A special note for this import.', 'your-textdomain' ),
188
+ 'preview_url' => 'http://www.your_domain.com/my-demo-2',
189
  ),
190
  );
191
  }
344
 
345
  == Changelog ==
346
 
347
+ = 2.3.0 =
348
+
349
+ *Release Date - 28 May 2017*
350
+
351
+ * Add preview button option to the predefined demo import items,
352
+ * Add custom JS event trigger when the import process is completed,
353
+ * Add custom filter for plugin page title,
354
+ * Remove content import as a required import. Now you can make separate imports for customizer, widgets or redux options.
355
+ * Fix custom menu widgets imports, the menus will now be set correctly.
356
+
357
  = 2.2.1 =
358
 
359
  *Release Date - 3 April 2017*
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit06f9575de8b884f593be69967ce35df0::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit88aa3f1d6cef3b1cfc6b86613d0c140f::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit06f9575de8b884f593be69967ce35df0
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit06f9575de8b884f593be69967ce35df0
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit06f9575de8b884f593be69967ce35df0', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit06f9575de8b884f593be69967ce35df0', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit06f9575de8b884f593be69967ce35df0::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit88aa3f1d6cef3b1cfc6b86613d0c140f
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit88aa3f1d6cef3b1cfc6b86613d0c140f', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit88aa3f1d6cef3b1cfc6b86613d0c140f', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit88aa3f1d6cef3b1cfc6b86613d0c140f::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit06f9575de8b884f593be69967ce35df0
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -31,8 +31,8 @@ class ComposerStaticInit06f9575de8b884f593be69967ce35df0
31
  public static function getInitializer(ClassLoader $loader)
32
  {
33
  return \Closure::bind(function () use ($loader) {
34
- $loader->prefixLengthsPsr4 = ComposerStaticInit06f9575de8b884f593be69967ce35df0::$prefixLengthsPsr4;
35
- $loader->prefixDirsPsr4 = ComposerStaticInit06f9575de8b884f593be69967ce35df0::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit88aa3f1d6cef3b1cfc6b86613d0c140f
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
31
  public static function getInitializer(ClassLoader $loader)
32
  {
33
  return \Closure::bind(function () use ($loader) {
34
+ $loader->prefixLengthsPsr4 = ComposerStaticInit88aa3f1d6cef3b1cfc6b86613d0c140f::$prefixLengthsPsr4;
35
+ $loader->prefixDirsPsr4 = ComposerStaticInit88aa3f1d6cef3b1cfc6b86613d0c140f::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }
vendor/composer/installed.json CHANGED
@@ -1,20 +1,20 @@
1
  [
2
  {
3
  "name": "proteusthemes/wp-content-importer-v2",
4
- "version": "v0.4.6",
5
- "version_normalized": "0.4.6.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/proteusthemes/WordPress-Importer.git",
9
- "reference": "e64018028c5a979cb7106c03b29f2a17a05d3710"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/proteusthemes/WordPress-Importer/zipball/e64018028c5a979cb7106c03b29f2a17a05d3710",
14
- "reference": "e64018028c5a979cb7106c03b29f2a17a05d3710",
15
  "shasum": ""
16
  },
17
- "time": "2017-03-26T16:14:12+00:00",
18
  "type": "library",
19
  "installation-source": "source",
20
  "autoload": {
@@ -41,7 +41,7 @@
41
  "wp"
42
  ],
43
  "support": {
44
- "source": "https://github.com/proteusthemes/WordPress-Importer/tree/v0.4.6"
45
  }
46
  }
47
  ]
1
  [
2
  {
3
  "name": "proteusthemes/wp-content-importer-v2",
4
+ "version": "v0.4.7",
5
+ "version_normalized": "0.4.7.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/proteusthemes/WordPress-Importer.git",
9
+ "reference": "ec052cc8fdcde29b47b69599b2b430e7fb423c22"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/proteusthemes/WordPress-Importer/zipball/ec052cc8fdcde29b47b69599b2b430e7fb423c22",
14
+ "reference": "ec052cc8fdcde29b47b69599b2b430e7fb423c22",
15
  "shasum": ""
16
  },
17
+ "time": "2017-05-02T11:07:20+00:00",
18
  "type": "library",
19
  "installation-source": "source",
20
  "autoload": {
41
  "wp"
42
  ],
43
  "support": {
44
+ "source": "https://github.com/proteusthemes/WordPress-Importer/tree/v0.4.7"
45
  }
46
  }
47
  ]
vendor/proteusthemes/wp-content-importer-v2/src/WXRImporter.php CHANGED
@@ -1141,7 +1141,7 @@ class WXRImporter extends \WP_Importer {
1141
  }
1142
  }
1143
 
1144
- if ( empty( $key ) || empty( $value ) ) {
1145
  return null;
1146
  }
1147
 
1141
  }
1142
  }
1143
 
1144
+ if ( empty( $key ) || ! isset( $value ) ) {
1145
  return null;
1146
  }
1147
 
views/plugin-page.php CHANGED
@@ -11,9 +11,13 @@ namespace OCDI;
11
 
12
  <div class="ocdi wrap about-wrap">
13
 
14
- <h1 class="ocdi__title dashicons-before dashicons-upload"><?php esc_html_e( 'One Click Demo Import', 'pt-ocdi' ); ?></h1>
15
-
16
  <?php
 
 
 
 
17
 
18
  // Display warrning if PHP safe mode is enabled, since we wont be able to change the max_execution_time.
19
  if ( ini_get( 'safe_mode' ) ) {
@@ -76,18 +80,18 @@ namespace OCDI;
76
  </div>
77
 
78
  <div class="ocdi__file-upload">
79
- <h3><label for="widget-file-upload"><?php esc_html_e( 'Choose a WIE or JSON file for widget import:', 'pt-ocdi' ); ?></label> <span><?php esc_html_e( '(*optional)', 'pt-ocdi' ); ?></span></h3>
80
  <input id="ocdi__widget-file-upload" type="file" name="widget-file-upload">
81
  </div>
82
 
83
  <div class="ocdi__file-upload">
84
- <h3><label for="customizer-file-upload"><?php esc_html_e( 'Choose a DAT file for customizer import:', 'pt-ocdi' ); ?></label> <span><?php esc_html_e( '(*optional)', 'pt-ocdi' ); ?></span></h3>
85
  <input id="ocdi__customizer-file-upload" type="file" name="customizer-file-upload">
86
  </div>
87
 
88
  <?php if ( class_exists( 'ReduxFramework' ) ) : ?>
89
  <div class="ocdi__file-upload">
90
- <h3><label for="redux-file-upload"><?php esc_html_e( 'Choose a JSON file for Redux import:', 'pt-ocdi' ); ?></label> <span><?php esc_html_e( '(*optional)', 'pt-ocdi' ); ?></span></h3>
91
  <input id="ocdi__redux-file-upload" type="file" name="redux-file-upload">
92
  <div>
93
  <label for="redux-option-name" class="ocdi__redux-option-name-label"><?php esc_html_e( 'Enter the Redux option name:', 'pt-ocdi' ); ?></label>
@@ -156,9 +160,12 @@ namespace OCDI;
156
  <div class="ocdi__gl-item-image ocdi__gl-item-image--no-image"><?php esc_html_e( 'No preview image.', 'pt-ocdi' ); ?></div>
157
  <?php endif; ?>
158
  </div>
159
- <div class="ocdi__gl-item-footer">
160
- <h4 class="ocdi__gl-item-title"><?php echo esc_html( $import_file['import_file_name'] ); ?></h4>
161
  <button class="ocdi__gl-item-button button button-primary js-ocdi-gl-import-data" value="<?php echo esc_attr( $index ); ?>"><?php esc_html_e( 'Import', 'pt-ocdi' ); ?></button>
 
 
 
162
  </div>
163
  </div>
164
  <?php endforeach; ?>
11
 
12
  <div class="ocdi wrap about-wrap">
13
 
14
+ <?php ob_start(); ?>
15
+ <h1 class="ocdi__title dashicons-before dashicons-upload"><?php esc_html_e( 'One Click Demo Import', 'pt-ocdi' ); ?></h1>
16
  <?php
17
+ $plugin_title = ob_get_clean();
18
+
19
+ // Display the plugin title (can be replaced with custom title text through the filter below).
20
+ echo wp_kses_post( apply_filters( 'pt-ocdi/plugin_page_title', $plugin_title ) );
21
 
22
  // Display warrning if PHP safe mode is enabled, since we wont be able to change the max_execution_time.
23
  if ( ini_get( 'safe_mode' ) ) {
80
  </div>
81
 
82
  <div class="ocdi__file-upload">
83
+ <h3><label for="widget-file-upload"><?php esc_html_e( 'Choose a WIE or JSON file for widget import:', 'pt-ocdi' ); ?></label></h3>
84
  <input id="ocdi__widget-file-upload" type="file" name="widget-file-upload">
85
  </div>
86
 
87
  <div class="ocdi__file-upload">
88
+ <h3><label for="customizer-file-upload"><?php esc_html_e( 'Choose a DAT file for customizer import:', 'pt-ocdi' ); ?></label></h3>
89
  <input id="ocdi__customizer-file-upload" type="file" name="customizer-file-upload">
90
  </div>
91
 
92
  <?php if ( class_exists( 'ReduxFramework' ) ) : ?>
93
  <div class="ocdi__file-upload">
94
+ <h3><label for="redux-file-upload"><?php esc_html_e( 'Choose a JSON file for Redux import:', 'pt-ocdi' ); ?></label></h3>
95
  <input id="ocdi__redux-file-upload" type="file" name="redux-file-upload">
96
  <div>
97
  <label for="redux-option-name" class="ocdi__redux-option-name-label"><?php esc_html_e( 'Enter the Redux option name:', 'pt-ocdi' ); ?></label>
160
  <div class="ocdi__gl-item-image ocdi__gl-item-image--no-image"><?php esc_html_e( 'No preview image.', 'pt-ocdi' ); ?></div>
161
  <?php endif; ?>
162
  </div>
163
+ <div class="ocdi__gl-item-footer<?php echo ! empty( $import_file['preview_url'] ) ? ' ocdi__gl-item-footer--with-preview' : ''; ?>">
164
+ <h4 class="ocdi__gl-item-title" title="<?php echo esc_attr( $import_file['import_file_name'] ); ?>"><?php echo esc_html( $import_file['import_file_name'] ); ?></h4>
165
  <button class="ocdi__gl-item-button button button-primary js-ocdi-gl-import-data" value="<?php echo esc_attr( $index ); ?>"><?php esc_html_e( 'Import', 'pt-ocdi' ); ?></button>
166
+ <?php if ( ! empty( $import_file['preview_url'] ) ) : ?>
167
+ <a class="ocdi__gl-item-button button" href="<?php echo esc_url( $import_file['preview_url'] ); ?>" target="_blank"><?php esc_html_e( 'Preview', 'pt-ocdi' ); ?></a>
168
+ <?php endif; ?>
169
  </div>
170
  </div>
171
  <?php endforeach; ?>