One Click Demo Import - Version 2.4.0

Version Description

Release Date - 23 August 2017

  • Add WP-CLI commands for importing with this plugin,
  • Fix conflict with WooCommerce importer
Download this release

Release Info

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

Code changes from version 2.3.0 to 2.4.0

inc/Importer.php CHANGED
@@ -27,7 +27,7 @@ class Importer {
27
  *
28
  * @var object
29
  */
30
- private $logger;
31
 
32
  /**
33
  * The instance of the One Click Demo Import class.
@@ -66,7 +66,6 @@ class Importer {
66
  */
67
  private function include_required_files() {
68
  if ( ! class_exists( '\WP_Importer' ) ) {
69
- defined( 'WP_LOAD_IMPORTERS' ) || define( 'WP_LOAD_IMPORTERS', true );
70
  require ABSPATH . '/wp-admin/includes/class-wp-importer.php';
71
  }
72
  }
27
  *
28
  * @var object
29
  */
30
+ public $logger;
31
 
32
  /**
33
  * The instance of the One Click Demo Import class.
66
  */
67
  private function include_required_files() {
68
  if ( ! class_exists( '\WP_Importer' ) ) {
 
69
  require ABSPATH . '/wp-admin/includes/class-wp-importer.php';
70
  }
71
  }
inc/OneClickDemoImport.php CHANGED
@@ -37,14 +37,14 @@ class OneClickDemoImport {
37
  *
38
  * @var array
39
  */
40
- private $import_files;
41
 
42
  /**
43
  * The path of the log file.
44
  *
45
  * @var string
46
  */
47
- private $log_file_path;
48
 
49
  /**
50
  * The index of the `import_files` array (which import files was selected).
@@ -65,7 +65,7 @@ class OneClickDemoImport {
65
  *
66
  * @var string
67
  */
68
- private $frontend_error_messages = array();
69
 
70
  /**
71
  * Was the before content import already triggered?
37
  *
38
  * @var array
39
  */
40
+ public $import_files;
41
 
42
  /**
43
  * The path of the log file.
44
  *
45
  * @var string
46
  */
47
+ public $log_file_path;
48
 
49
  /**
50
  * The index of the `import_files` array (which import files was selected).
65
  *
66
  * @var string
67
  */
68
+ public $frontend_error_messages = array();
69
 
70
  /**
71
  * Was the before content import already triggered?
inc/WPCLICommands.php ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The class for WP-CLI commands for One Click Demo Import plugin.
4
+ *
5
+ * @package ocdi
6
+ */
7
+
8
+ namespace OCDI;
9
+
10
+ use WP_CLI;
11
+
12
+ class WPCLICommands extends \WP_CLI_Command {
13
+
14
+ /**
15
+ * @var object Main OCDI class object.
16
+ */
17
+ private $ocdi;
18
+
19
+ public function __construct() {
20
+ parent::__construct();
21
+
22
+ $this->ocdi = OneClickDemoImport::get_instance();
23
+
24
+ Helpers::set_demo_import_start_time();
25
+
26
+ $this->ocdi->log_file_path = Helpers::get_log_path();
27
+ }
28
+
29
+ /**
30
+ * List all predefined demo imports.
31
+ */
32
+ public function list_predefined() {
33
+ if ( empty( $this->ocdi->import_files ) ) {
34
+ WP_CLI::error( esc_html__( 'There are no predefined demo imports for currently active theme!', 'pt-ocdi' ) );
35
+ }
36
+
37
+ WP_CLI::success( esc_html__( 'Here are the predefined demo imports:', 'pt-ocdi' ) );
38
+
39
+ foreach ( $this->ocdi->import_files as $index => $import_file ) {
40
+ WP_CLI::log( sprintf(
41
+ '%d -> %s [content: %s, widgets: %s, customizer: %s, redux: %s]',
42
+ $index,
43
+ $import_file['import_file_name'],
44
+ empty( $import_file['import_file_url'] ) && empty( $import_file['local_import_file'] ) ? 'no' : 'yes',
45
+ empty( $import_file['import_widget_file_url'] ) && empty( $import_file['local_import_widget_file'] ) ? 'no' : 'yes',
46
+ empty( $import_file['import_customizer_file_url'] ) && empty( $import_file['local_import_customizer_file'] ) ? 'no' : 'yes',
47
+ empty( $import_file['import_redux'] ) && empty( $import_file['local_import_redux'] ) ? 'no' : 'yes'
48
+ ) );
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Import content/widgets/customizer settings with the OCDI plugin.
54
+ *
55
+ * ## OPTIONS
56
+ *
57
+ * [--content=<file>]
58
+ * : Content file (XML), that will be used to import the content.
59
+ *
60
+ * [--widgets=<file>]
61
+ * : Widgets file (JSON or WIE), that will be used to import the widgets.
62
+ *
63
+ * [--customizer=<file>]
64
+ * : Customizer file (DAT), that will be used to import the customizer settings.
65
+ *
66
+ * [--predefined=<index>]
67
+ * : The index of the predefined demo imports (use the 'list_predefined' command to check the predefined demo imports)
68
+ */
69
+ public function import( $args, $assoc_args ) {
70
+ if ( ! $this->any_import_options_set( $assoc_args ) ) {
71
+ WP_CLI::error( esc_html__( 'At least one of the possible options should be set! Check them with --help', 'pt-ocdi' ) );
72
+ }
73
+
74
+ if ( isset( $assoc_args['predefined'] ) ) {
75
+ $this->import_predefined( $assoc_args['predefined'] );
76
+ }
77
+
78
+ if ( ! empty( $assoc_args['content'] ) ) {
79
+ $this->import_content( $assoc_args['content'] );
80
+ }
81
+
82
+ if ( ! empty( $assoc_args['widgets'] ) ) {
83
+ $this->import_widgets( $assoc_args['widgets'] );
84
+ }
85
+
86
+ if ( ! empty( $assoc_args['customizer'] ) ) {
87
+ $this->import_customizer( $assoc_args['customizer'] );
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Check if any of the possible options are set.
93
+ *
94
+ * @param array $options
95
+ *
96
+ * @return bool
97
+ */
98
+ private function any_import_options_set( $options ) {
99
+ $possible_options = array(
100
+ 'content',
101
+ 'widgets',
102
+ 'customizer',
103
+ 'predefined',
104
+ );
105
+
106
+ foreach ( $possible_options as $option ) {
107
+ if ( array_key_exists( $option, $options ) ) {
108
+ return true;
109
+ }
110
+ }
111
+
112
+ return false;
113
+ }
114
+
115
+ /**
116
+ * Import the predefined demo content/widgets/customizer settings with OCDI.
117
+ *
118
+ * @param int $predefined_index Index of a OCDI predefined demo import.
119
+ */
120
+ private function import_predefined( $predefined_index ) {
121
+ if ( ! is_numeric( $predefined_index ) ) {
122
+ WP_CLI::error( esc_html__( 'The "predefined" parameter should be a number (an index of the OCDI predefined demo import)!', 'pt-ocdi' ) );
123
+ }
124
+
125
+ $predefined_index = absint( $predefined_index );
126
+
127
+ if ( ! array_key_exists( $predefined_index, $this->ocdi->import_files ) ) {
128
+ WP_CLI::warning( esc_html__( 'The supplied predefined index does not exist! Please take a look at the available predefined demo imports:', 'pt-ocdi' ) );
129
+
130
+ $this->list_predefined();
131
+
132
+ return false;
133
+ }
134
+
135
+ WP_CLI::log( esc_html__( 'Predefined demo import started! All other parameters will be ignored!', 'pt-ocdi' ) );
136
+
137
+ $selected_files = $this->ocdi->import_files[ $predefined_index ];
138
+
139
+ if ( ! empty( $selected_files['import_file_name'] ) ) {
140
+ WP_CLI::log( sprintf( esc_html__( 'Selected predefined demo import: %s', 'pt-ocdi' ), $selected_files['import_file_name'] ) );
141
+ }
142
+
143
+ WP_CLI::log( esc_html__( 'Preparing the demo import files...', 'pt-ocdi' ) );
144
+
145
+ $import_files = Helpers::download_import_files( $selected_files );
146
+
147
+ if ( empty( $import_files ) ) {
148
+ WP_CLI::error( esc_html__( 'Demo import files could not be retrieved!', 'pt-ocdi' ) );
149
+ }
150
+
151
+ WP_CLI::log( esc_html__( 'Demo import files retrieved successfully!', 'pt-ocdi' ) );
152
+
153
+ WP_CLI::log( esc_html__( 'Importing...', 'pt-ocdi' ) );
154
+
155
+ if ( ! empty( $import_files['content'] ) ) {
156
+ $this->do_action( 'pt-ocdi/before_content_import_execution', $import_files, $this->ocdi->import_files, $predefined_index );
157
+
158
+ $this->import_content( $import_files['content'] );
159
+ }
160
+
161
+ if ( ! empty( $import_files['widgets'] ) ) {
162
+ $this->do_action( 'pt-ocdi/before_widgets_import', $import_files );
163
+
164
+ $this->import_widgets( $import_files['widgets'] );
165
+ }
166
+
167
+ if ( ! empty( $import_files['customizer'] ) ) {
168
+ $this->import_customizer( $import_files['customizer'] );
169
+ }
170
+
171
+ $this->do_action( 'pt-ocdi/after_all_import_execution', $import_files, $this->ocdi->import_files, $predefined_index );
172
+
173
+ WP_CLI::log( esc_html__( 'Predefined import finished!', 'pt-ocdi' ) );
174
+ }
175
+
176
+ /**
177
+ * Import the content with OCDI.
178
+ *
179
+ * @param string $relative_file_path Relative file path to the content import file.
180
+ */
181
+ private function import_content( $relative_file_path ) {
182
+ $content_import_file_path = realpath( $relative_file_path );
183
+
184
+ if ( ! file_exists( $content_import_file_path ) ) {
185
+ WP_CLI::warning( esc_html__( 'Content import file provided does not exist! Skipping this import!', 'pt-ocdi' ) );
186
+ return false;
187
+ }
188
+
189
+ // Change the single AJAX call duration so the whole content import will be done in one go.
190
+ add_filter( 'pt-ocdi/time_for_one_ajax_call', function() {
191
+ return 3600;
192
+ } );
193
+
194
+ WP_CLI::log( esc_html__( 'Importing content (this might take a while)...', 'pt-ocdi' ) );
195
+
196
+ Helpers::append_to_file( '', $this->ocdi->log_file_path, esc_html__( 'Importing content' , 'pt-ocdi' ) );
197
+
198
+ $this->ocdi->append_to_frontend_error_messages( $this->ocdi->importer->import_content( $content_import_file_path ) );
199
+
200
+ if( empty( $this->ocdi->frontend_error_messages ) ) {
201
+ WP_CLI::success( esc_html__( 'Content import finished!', 'pt-ocdi' ) );
202
+ }
203
+ else {
204
+ WP_CLI::warning( esc_html__( 'There were some issues while importing the content!', 'pt-ocdi' ) );
205
+
206
+ foreach ( $this->ocdi->frontend_error_messages as $line ) {
207
+ WP_CLI::log( $line );
208
+ }
209
+
210
+ $this->ocdi->frontend_error_messages = array();
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Import the widgets with OCDI.
216
+ *
217
+ * @param string $relative_file_path Relative file path to the widgets import file.
218
+ */
219
+ private function import_widgets( $relative_file_path ) {
220
+ $widgets_import_file_path = realpath( $relative_file_path );
221
+
222
+ if ( ! file_exists( $widgets_import_file_path ) ) {
223
+ WP_CLI::warning( esc_html__( 'Widgets import file provided does not exist! Skipping this import!', 'pt-ocdi' ) );
224
+ return false;
225
+ }
226
+
227
+ WP_CLI::log( esc_html__( 'Importing widgets...', 'pt-ocdi' ) );
228
+
229
+ WidgetImporter::import( $widgets_import_file_path );
230
+
231
+ if( empty( $this->ocdi->frontend_error_messages ) ) {
232
+ WP_CLI::success( esc_html__( 'Widgets imported successfully!', 'pt-ocdi' ) );
233
+ }
234
+ else {
235
+ WP_CLI::warning( esc_html__( 'There were some issues while importing widgets!', 'pt-ocdi' ) );
236
+
237
+ foreach ( $this->ocdi->frontend_error_messages as $line ) {
238
+ WP_CLI::log( $line );
239
+ }
240
+
241
+ $this->ocdi->frontend_error_messages = array();
242
+ }
243
+ }
244
+
245
+ /**
246
+ * Import the customizer settings with OCDI.
247
+ *
248
+ * @param string $relative_file_path Relative file path to the customizer import file.
249
+ */
250
+ private function import_customizer( $relative_file_path ) {
251
+ $customizer_import_file_path = realpath( $relative_file_path );
252
+
253
+ if ( ! file_exists( $customizer_import_file_path ) ) {
254
+ WP_CLI::warning( esc_html__( 'Customizer import file provided does not exist! Skipping this import!', 'pt-ocdi' ) );
255
+ return false;
256
+ }
257
+
258
+ WP_CLI::log( esc_html__( 'Importing customizer settings...', 'pt-ocdi' ) );
259
+
260
+ CustomizerImporter::import( $customizer_import_file_path );
261
+
262
+ if( empty( $this->ocdi->frontend_error_messages ) ) {
263
+ WP_CLI::success( esc_html__( 'Customizer settings imported successfully!', 'pt-ocdi' ) );
264
+ }
265
+ else {
266
+ WP_CLI::warning( esc_html__( 'There were some issues while importing customizer settings!', 'pt-ocdi' ) );
267
+
268
+ foreach ( $this->ocdi->frontend_error_messages as $line ) {
269
+ WP_CLI::log( $line );
270
+ }
271
+
272
+ $this->ocdi->frontend_error_messages = array();
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Run the registered actions.
278
+ *
279
+ * @param string $action Name of the action.
280
+ * @param array $selected_files Selected import files.
281
+ * @param array $all_import_files All predefined demos.
282
+ * @param null $selected_index Selected predefined index.
283
+ */
284
+ private function do_action( $action, $import_files = array(), $all_import_files = array(), $selected_index = null ) {
285
+ if ( false !== has_action( $action ) ) {
286
+ WP_CLI::log( sprintf( esc_html__( 'Executing action: %s ...', 'pt-ocdi' ), $action ) );
287
+
288
+ ob_start();
289
+ do_action( $action, $import_files, $all_import_files, $selected_index );
290
+ $message = ob_get_clean();
291
+
292
+ Helpers::append_to_file( $message, $this->ocdi->log_file_path, $action );
293
+ }
294
+ }
295
+ }
languages/pt-ocdi.pot CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the GPL 2.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: One Click Demo Import 2.2.1\n"
6
  "Report-Msgid-Bugs-To: http://support.proteusthemes.com/\n"
7
  "POT-Creation-Date: 2016-05-14 09:53:17+00:00\n"
8
  "MIME-Version: 1.0\n"
@@ -149,7 +149,7 @@ msgstr ""
149
  msgid "not defined!"
150
  msgstr ""
151
 
152
- #: inc/Importer.php:173
153
  msgid "New AJAX call!"
154
  msgstr ""
155
 
@@ -234,6 +234,114 @@ msgid ""
234
  "imported!"
235
  msgstr ""
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  #: inc/WidgetImporter.php:40 inc/WidgetImporter.php:52
238
  msgid "Importing widgets"
239
  msgstr ""
@@ -274,7 +382,7 @@ msgstr ""
274
  msgid "No results for widget import!"
275
  msgstr ""
276
 
277
- #: one-click-demo-import.php:51
278
  msgid ""
279
  "The %2$sOne Click Demo Import%3$s plugin requires %2$sPHP 5.3.2+%3$s to run "
280
  "properly. Please contact your hosting company and ask them to update the "
2
  # This file is distributed under the GPL 2.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: One Click Demo Import 2.4.0\n"
6
  "Report-Msgid-Bugs-To: http://support.proteusthemes.com/\n"
7
  "POT-Creation-Date: 2016-05-14 09:53:17+00:00\n"
8
  "MIME-Version: 1.0\n"
149
  msgid "not defined!"
150
  msgstr ""
151
 
152
+ #: inc/Importer.php:172
153
  msgid "New AJAX call!"
154
  msgstr ""
155
 
234
  "imported!"
235
  msgstr ""
236
 
237
+ #: inc/WPCLICommands.php:34
238
+ msgid "There are no predefined demo imports for currently active theme!"
239
+ msgstr ""
240
+
241
+ #: inc/WPCLICommands.php:37
242
+ msgid "Here are the predefined demo imports:"
243
+ msgstr ""
244
+
245
+ #: inc/WPCLICommands.php:71
246
+ msgid "At least one of the possible options should be set! Check them with --help"
247
+ msgstr ""
248
+
249
+ #: inc/WPCLICommands.php:122
250
+ msgid ""
251
+ "The \"predefined\" parameter should be a number (an index of the OCDI "
252
+ "predefined demo import)!"
253
+ msgstr ""
254
+
255
+ #: inc/WPCLICommands.php:128
256
+ msgid ""
257
+ "The supplied predefined index does not exist! Please take a look at the "
258
+ "available predefined demo imports:"
259
+ msgstr ""
260
+
261
+ #: inc/WPCLICommands.php:135
262
+ msgid "Predefined demo import started! All other parameters will be ignored!"
263
+ msgstr ""
264
+
265
+ #: inc/WPCLICommands.php:140
266
+ msgid "Selected predefined demo import: %s"
267
+ msgstr ""
268
+
269
+ #: inc/WPCLICommands.php:143
270
+ msgid "Preparing the demo import files..."
271
+ msgstr ""
272
+
273
+ #: inc/WPCLICommands.php:148
274
+ msgid "Demo import files could not be retrieved!"
275
+ msgstr ""
276
+
277
+ #: inc/WPCLICommands.php:151
278
+ msgid "Demo import files retrieved successfully!"
279
+ msgstr ""
280
+
281
+ #: inc/WPCLICommands.php:153
282
+ msgid "Importing..."
283
+ msgstr ""
284
+
285
+ #: inc/WPCLICommands.php:173
286
+ msgid "Predefined import finished!"
287
+ msgstr ""
288
+
289
+ #: inc/WPCLICommands.php:185
290
+ msgid "Content import file provided does not exist! Skipping this import!"
291
+ msgstr ""
292
+
293
+ #: inc/WPCLICommands.php:194
294
+ msgid "Importing content (this might take a while)..."
295
+ msgstr ""
296
+
297
+ #: inc/WPCLICommands.php:196
298
+ msgid "Importing content"
299
+ msgstr ""
300
+
301
+ #: inc/WPCLICommands.php:201
302
+ msgid "Content import finished!"
303
+ msgstr ""
304
+
305
+ #: inc/WPCLICommands.php:204
306
+ msgid "There were some issues while importing the content!"
307
+ msgstr ""
308
+
309
+ #: inc/WPCLICommands.php:223
310
+ msgid "Widgets import file provided does not exist! Skipping this import!"
311
+ msgstr ""
312
+
313
+ #: inc/WPCLICommands.php:227
314
+ msgid "Importing widgets..."
315
+ msgstr ""
316
+
317
+ #: inc/WPCLICommands.php:232
318
+ msgid "Widgets imported successfully!"
319
+ msgstr ""
320
+
321
+ #: inc/WPCLICommands.php:235
322
+ msgid "There were some issues while importing widgets!"
323
+ msgstr ""
324
+
325
+ #: inc/WPCLICommands.php:254
326
+ msgid "Customizer import file provided does not exist! Skipping this import!"
327
+ msgstr ""
328
+
329
+ #: inc/WPCLICommands.php:258
330
+ msgid "Importing customizer settings..."
331
+ msgstr ""
332
+
333
+ #: inc/WPCLICommands.php:263
334
+ msgid "Customizer settings imported successfully!"
335
+ msgstr ""
336
+
337
+ #: inc/WPCLICommands.php:266
338
+ msgid "There were some issues while importing customizer settings!"
339
+ msgstr ""
340
+
341
+ #: inc/WPCLICommands.php:286
342
+ msgid "Executing action: %s ..."
343
+ msgstr ""
344
+
345
  #: inc/WidgetImporter.php:40 inc/WidgetImporter.php:52
346
  msgid "Importing widgets"
347
  msgstr ""
382
  msgid "No results for widget import!"
383
  msgstr ""
384
 
385
+ #: one-click-demo-import.php:57
386
  msgid ""
387
  "The %2$sOne Click Demo Import%3$s plugin requires %2$sPHP 5.3.2+%3$s to run "
388
  "properly. Please contact your hosting company and ask them to update the "
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.3.0
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
@@ -39,6 +39,12 @@ class OCDI_Plugin {
39
 
40
  // Instantiate the main plugin class *Singleton*.
41
  $pt_one_click_demo_import = OCDI\OneClickDemoImport::get_instance();
 
 
 
 
 
 
42
  }
43
  }
44
 
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.4.0
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
39
 
40
  // Instantiate the main plugin class *Singleton*.
41
  $pt_one_click_demo_import = OCDI\OneClickDemoImport::get_instance();
42
+
43
+ // Register WP CLI commands
44
+ if ( defined( 'WP_CLI' ) && WP_CLI ) {
45
+ WP_CLI::add_command( 'ocdi list', array( 'OCDI\WPCLICommands', 'list_predefined' ) );
46
+ WP_CLI::add_command( 'ocdi import', array( 'OCDI\WPCLICommands', 'import' ) );
47
+ }
48
  }
49
  }
50
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === One Click Demo Import ===
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.
@@ -227,6 +227,24 @@ function ocdi_before_widgets_import( $selected_import ) {
227
  add_action( 'pt-ocdi/before_widgets_import', 'ocdi_before_widgets_import' );
228
  `
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  = I'm a theme author and I want to change the plugin intro text, how can I do that? =
231
 
232
  You can change the plugin intro text by using the `pt-ocdi/plugin_intro_text` filter:
@@ -344,6 +362,13 @@ Please visit this [docs page](https://github.com/proteusthemes/one-click-demo-im
344
 
345
  == Changelog ==
346
 
 
 
 
 
 
 
 
347
  = 2.3.0 =
348
 
349
  *Release Date - 28 May 2017*
1
  === One Click Demo Import ===
2
+ Contributors: capuderg, cyman, Prelc, proteusthemes
3
  Tags: import, content, demo, data, widgets, settings, redux, theme options
4
  Requires at least: 4.0.0
5
+ Tested up to: 4.9
6
+ Stable tag: 2.4.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.
227
  add_action( 'pt-ocdi/before_widgets_import', 'ocdi_before_widgets_import' );
228
  `
229
 
230
+ = How can I import via the WP-CLI? =
231
+
232
+ In the 2.4.0 version of this pugin we added two WP-CLI commands:
233
+
234
+ * `wp ocdi list` - Which will list any predefined demo imports currently active theme might have,
235
+ * `wp ocdi import` - which has a few options that you can use to import the things you want (content/widgets/customizer/predefined demos). Let's look at these options below.
236
+
237
+ `wp ocdi import` options:
238
+
239
+ `wp ocdi import [--content=<file>] [--widgets=<file>] [--customizer=<file>] [--predefined=<index>]`
240
+
241
+ * `--content=<file>` - will run the content import with the WP import file specified in the `<file>` parameter,
242
+ * `--widgets=<file>` - will run the widgets import with the widgets import file specified in the `<file>` parameter,
243
+ * `--customizer=<file>` - will run the customizer settings import with the customizer import file specified in the `<file>` parameter,
244
+ * `--predefined=<index>` - will run the theme predefined import with the index of the predefined import in the `<index>` parameter (you can use the `wp ocdi list` command to check which index is used for each predefined demo import)
245
+
246
+ The content, widgets and customizer options can be mixed and used at the same time. If the `predefined` option is set, then it will ignore all other options and import the predefined demo data.
247
+
248
  = I'm a theme author and I want to change the plugin intro text, how can I do that? =
249
 
250
  You can change the plugin intro text by using the `pt-ocdi/plugin_intro_text` filter:
362
 
363
  == Changelog ==
364
 
365
+ = 2.4.0 =
366
+
367
+ *Release Date - 23 August 2017*
368
+
369
+ * Add WP-CLI commands for importing with this plugin,
370
+ * Fix conflict with WooCommerce importer
371
+
372
  = 2.3.0 =
373
 
374
  *Release Date - 28 May 2017*
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit88aa3f1d6cef3b1cfc6b86613d0c140f::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInite70ea380d43073ce103daddb33b73ed6::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit88aa3f1d6cef3b1cfc6b86613d0c140f
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit88aa3f1d6cef3b1cfc6b86613d0c140f
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) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInite70ea380d43073ce103daddb33b73ed6
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInite70ea380d43073ce103daddb33b73ed6', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInite70ea380d43073ce103daddb33b73ed6', '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\ComposerStaticInite70ea380d43073ce103daddb33b73ed6::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 ComposerStaticInit88aa3f1d6cef3b1cfc6b86613d0c140f
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -31,8 +31,8 @@ class ComposerStaticInit88aa3f1d6cef3b1cfc6b86613d0c140f
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
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInite70ea380d43073ce103daddb33b73ed6
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 = ComposerStaticInite70ea380d43073ce103daddb33b73ed6::$prefixLengthsPsr4;
35
+ $loader->prefixDirsPsr4 = ComposerStaticInite70ea380d43073ce103daddb33b73ed6::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }