One Click Demo Import - Version 2.5.0

Version Description

Release Date - 8 January 2018

  • Add OCDI as a WordPress import tool in Tools -> Import,
  • Add switching to the manual import, if the theme has predefined demo imports,
  • Fix text domain loading
Download this release

Release Info

Developer proteusthemes
Plugin Icon 128x128 One Click Demo Import
Version 2.5.0
Comparing to
See all releases

Code changes from version 2.4.0 to 2.5.0

assets/css/main.css CHANGED
@@ -56,6 +56,11 @@
56
  list-style-type: square;
57
  }
58
 
 
 
 
 
 
59
  /* Plugin multi select import and Plugin file upload containers */
60
 
61
  .ocdi__file-upload,
56
  list-style-type: square;
57
  }
58
 
59
+ /* Plugin switch import mode link*/
60
+ .ocdi__import-mode-switch {
61
+ float: right;
62
+ }
63
+
64
  /* Plugin multi select import and Plugin file upload containers */
65
 
66
  .ocdi__file-upload,
inc/OneClickDemoImport.php CHANGED
@@ -74,6 +74,12 @@ class OneClickDemoImport {
74
  */
75
  private $before_import_executed = false;
76
 
 
 
 
 
 
 
77
 
78
  /**
79
  * Returns the *Singleton* instance of this class.
@@ -126,26 +132,27 @@ class OneClickDemoImport {
126
  * Creates the plugin page and a submenu item in WP Appearance menu.
127
  */
128
  public function create_plugin_page() {
129
- $plugin_page_setup = apply_filters( 'pt-ocdi/plugin_page_setup', array(
130
- 'parent_slug' => 'themes.php',
131
- 'page_title' => esc_html__( 'One Click Demo Import' , 'pt-ocdi' ),
132
- 'menu_title' => esc_html__( 'Import Demo Data' , 'pt-ocdi' ),
133
- 'capability' => 'import',
134
- 'menu_slug' => 'pt-one-click-demo-import',
135
- )
136
- );
137
 
138
  $this->plugin_page = add_submenu_page(
139
- $plugin_page_setup['parent_slug'],
140
- $plugin_page_setup['page_title'],
141
- $plugin_page_setup['menu_title'],
142
- $plugin_page_setup['capability'],
143
- $plugin_page_setup['menu_slug'],
144
  apply_filters( 'pt-ocdi/plugin_page_display_callback_function', array( $this, 'display_plugin_page' ) )
145
  );
146
- }
147
 
 
 
148
 
 
149
  /**
150
  * Plugin page display.
151
  * Output (HTML) is in another file.
@@ -162,7 +169,7 @@ class OneClickDemoImport {
162
  */
163
  public function admin_enqueue_scripts( $hook ) {
164
  // Enqueue the scripts only on the plugin page.
165
- if ( $this->plugin_page === $hook ) {
166
  wp_enqueue_script( 'jquery-ui-dialog' );
167
  wp_enqueue_style( 'wp-jquery-ui-dialog' );
168
 
@@ -513,7 +520,7 @@ class OneClickDemoImport {
513
  * Load the plugin textdomain, so that translations can be made.
514
  */
515
  public function load_textdomain() {
516
- load_plugin_textdomain( 'pt-ocdi', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
517
  }
518
 
519
 
74
  */
75
  private $before_import_executed = false;
76
 
77
+ /**
78
+ * Make plugin page options available to other methods.
79
+ *
80
+ * @var array
81
+ */
82
+ private $plugin_page_setup = array();
83
 
84
  /**
85
  * Returns the *Singleton* instance of this class.
132
  * Creates the plugin page and a submenu item in WP Appearance menu.
133
  */
134
  public function create_plugin_page() {
135
+ $this->plugin_page_setup = apply_filters( 'pt-ocdi/plugin_page_setup', array(
136
+ 'parent_slug' => 'themes.php',
137
+ 'page_title' => esc_html__( 'One Click Demo Import' , 'pt-ocdi' ),
138
+ 'menu_title' => esc_html__( 'Import Demo Data' , 'pt-ocdi' ),
139
+ 'capability' => 'import',
140
+ 'menu_slug' => 'pt-one-click-demo-import',
141
+ ) );
 
142
 
143
  $this->plugin_page = add_submenu_page(
144
+ $this->plugin_page_setup['parent_slug'],
145
+ $this->plugin_page_setup['page_title'],
146
+ $this->plugin_page_setup['menu_title'],
147
+ $this->plugin_page_setup['capability'],
148
+ $this->plugin_page_setup['menu_slug'],
149
  apply_filters( 'pt-ocdi/plugin_page_display_callback_function', array( $this, 'display_plugin_page' ) )
150
  );
 
151
 
152
+ register_importer( $this->plugin_page_setup['menu_slug'], $this->plugin_page_setup['page_title'], $this->plugin_page_setup['menu_title'], apply_filters( 'pt-ocdi/plugin_page_display_callback_function', array( $this, 'display_plugin_page' ) ) );
153
+ }
154
 
155
+
156
  /**
157
  * Plugin page display.
158
  * Output (HTML) is in another file.
169
  */
170
  public function admin_enqueue_scripts( $hook ) {
171
  // Enqueue the scripts only on the plugin page.
172
+ if ( $this->plugin_page === $hook || ( 'admin.php' === $hook && $this->plugin_page_setup['menu_slug'] === esc_attr( $_GET['import'] ) ) ) {
173
  wp_enqueue_script( 'jquery-ui-dialog' );
174
  wp_enqueue_style( 'wp-jquery-ui-dialog' );
175
 
520
  * Load the plugin textdomain, so that translations can be made.
521
  */
522
  public function load_textdomain() {
523
+ load_plugin_textdomain( 'pt-ocdi', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/languages' );
524
  }
525
 
526
 
languages/pt-ocdi.pot CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2017 ProteusThemes
2
  # This file is distributed under the GPL 2.0.
3
  msgid ""
4
  msgstr ""
@@ -8,7 +8,7 @@ msgstr ""
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
@@ -81,7 +81,7 @@ msgstr ""
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
 
@@ -153,55 +153,55 @@ msgstr ""
153
  msgid "New AJAX call!"
154
  msgstr ""
155
 
156
- #: inc/OneClickDemoImport.php:183
157
  msgid "No preview image defined for this import."
158
  msgstr ""
159
 
160
- #: inc/OneClickDemoImport.php:184
161
  msgid "Are you sure?"
162
  msgstr ""
163
 
164
- #: inc/OneClickDemoImport.php:185
165
  msgid "Cancel"
166
  msgstr ""
167
 
168
- #: inc/OneClickDemoImport.php:186
169
  msgid "Yes, import!"
170
  msgstr ""
171
 
172
- #: inc/OneClickDemoImport.php:187
173
  msgid "Selected demo import:"
174
  msgstr ""
175
 
176
- #: inc/OneClickDemoImport.php:234
177
  msgid "Manually uploaded files"
178
  msgstr ""
179
 
180
- #: inc/OneClickDemoImport.php:247 inc/OneClickDemoImport.php:258
181
  msgid "Downloaded files"
182
  msgstr ""
183
 
184
- #: inc/OneClickDemoImport.php:254
185
  msgid "The import files for: %s were successfully downloaded!"
186
  msgstr ""
187
 
188
- #: inc/OneClickDemoImport.php:263
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,7 +209,7 @@ msgid ""
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 "
1
+ # Copyright (C) 2018 ProteusThemes
2
  # This file is distributed under the GPL 2.0.
3
  msgid ""
4
  msgstr ""
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
81
  msgid "One Click Demo Import"
82
  msgstr ""
83
 
84
+ #: inc/Helpers.php:309 inc/OneClickDemoImport.php:138
85
  msgid "Import Demo Data"
86
  msgstr ""
87
 
153
  msgid "New AJAX call!"
154
  msgstr ""
155
 
156
+ #: inc/OneClickDemoImport.php:190
157
  msgid "No preview image defined for this import."
158
  msgstr ""
159
 
160
+ #: inc/OneClickDemoImport.php:191
161
  msgid "Are you sure?"
162
  msgstr ""
163
 
164
+ #: inc/OneClickDemoImport.php:192
165
  msgid "Cancel"
166
  msgstr ""
167
 
168
+ #: inc/OneClickDemoImport.php:193
169
  msgid "Yes, import!"
170
  msgstr ""
171
 
172
+ #: inc/OneClickDemoImport.php:194
173
  msgid "Selected demo import:"
174
  msgstr ""
175
 
176
+ #: inc/OneClickDemoImport.php:241
177
  msgid "Manually uploaded files"
178
  msgstr ""
179
 
180
+ #: inc/OneClickDemoImport.php:254 inc/OneClickDemoImport.php:265
181
  msgid "Downloaded files"
182
  msgstr ""
183
 
184
+ #: inc/OneClickDemoImport.php:261
185
  msgid "The import files for: %s were successfully downloaded!"
186
  msgstr ""
187
 
188
+ #: inc/OneClickDemoImport.php:270
189
  msgid "No import files specified!"
190
  msgstr ""
191
 
192
+ #: inc/OneClickDemoImport.php:391
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:394
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:407
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:418
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.4.0
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.5.0
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.
@@ -362,6 +362,14 @@ Please visit this [docs page](https://github.com/proteusthemes/one-click-demo-im
362
 
363
  == Changelog ==
364
 
 
 
 
 
 
 
 
 
365
  = 2.4.0 =
366
 
367
  *Release Date - 23 August 2017*
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.5.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.
362
 
363
  == Changelog ==
364
 
365
+ = 2.5.0 =
366
+
367
+ *Release Date - 8 January 2018*
368
+
369
+ * Add OCDI as a WordPress import tool in Tools -> Import,
370
+ * Add switching to the manual import, if the theme has predefined demo imports,
371
+ * Fix text domain loading
372
+
373
  = 2.4.0 =
374
 
375
  *Release Date - 23 August 2017*
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInite70ea380d43073ce103daddb33b73ed6::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit95d1b4e5d3479efaf105848f37b3cf4d::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -379,9 +379,9 @@ class ClassLoader
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
 
382
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
383
- $length = $this->prefixLengthsPsr4[$first][$search];
384
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
385
  return $file;
386
  }
387
  }
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
 
385
  return $file;
386
  }
387
  }
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInite70ea380d43073ce103daddb33b73ed6
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInite70ea380d43073ce103daddb33b73ed6
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) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit95d1b4e5d3479efaf105848f37b3cf4d
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit95d1b4e5d3479efaf105848f37b3cf4d', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit95d1b4e5d3479efaf105848f37b3cf4d', '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\ComposerStaticInit95d1b4e5d3479efaf105848f37b3cf4d::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 ComposerStaticInite70ea380d43073ce103daddb33b73ed6
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -31,8 +31,8 @@ class ComposerStaticInite70ea380d43073ce103daddb33b73ed6
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
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit95d1b4e5d3479efaf105848f37b3cf4d
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 = ComposerStaticInit95d1b4e5d3479efaf105848f37b3cf4d::$prefixLengthsPsr4;
35
+ $loader->prefixDirsPsr4 = ComposerStaticInit95d1b4e5d3479efaf105848f37b3cf4d::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }
views/plugin-page.php CHANGED
@@ -7,6 +7,12 @@
7
 
8
  namespace OCDI;
9
 
 
 
 
 
 
 
10
  ?>
11
 
12
  <div class="ocdi wrap about-wrap">
@@ -54,6 +60,14 @@ namespace OCDI;
54
  <li><?php esc_html_e( 'Please click on the Import button only once and wait, it can take a couple of minutes.', 'pt-ocdi' ); ?></li>
55
  </ul>
56
 
 
 
 
 
 
 
 
 
57
  <hr>
58
  </div>
59
 
@@ -64,12 +78,13 @@ namespace OCDI;
64
  echo wp_kses_post( apply_filters( 'pt-ocdi/plugin_intro_text', $plugin_intro_text ) );
65
  ?>
66
 
67
-
68
  <?php if ( empty( $this->import_files ) ) : ?>
69
-
70
  <div class="notice notice-info is-dismissible">
71
  <p><?php esc_html_e( 'There are no predefined import files available in this theme. Please upload the import files manually!', 'pt-ocdi' ); ?></p>
72
  </div>
 
 
 
73
 
74
  <div class="ocdi__file-upload-container">
75
  <h2><?php esc_html_e( 'Manual demo files upload', 'pt-ocdi' ); ?></h2>
@@ -105,11 +120,11 @@ namespace OCDI;
105
  <button class="ocdi__button button button-hero button-primary js-ocdi-import-data"><?php esc_html_e( 'Import Demo Data', 'pt-ocdi' ); ?></button>
106
  </p>
107
 
108
- <?php elseif ( 1 === count( $this->import_files ) ) : ?>
109
 
110
  <div class="ocdi__demo-import-notice js-ocdi-demo-import-notice"><?php
111
- if ( is_array( $this->import_files ) && ! empty( $this->import_files[0]['import_notice'] ) ) {
112
- echo wp_kses_post( $this->import_files[0]['import_notice'] );
113
  }
114
  ?></div>
115
 
@@ -123,7 +138,7 @@ namespace OCDI;
123
  <div class="ocdi__gl js-ocdi-gl">
124
  <?php
125
  // Prepare navigation data.
126
- $categories = Helpers::get_all_demo_import_categories( $this->import_files );
127
  ?>
128
  <?php if ( ! empty( $categories ) ) : ?>
129
  <div class="ocdi__gl-header js-ocdi-gl-header">
@@ -141,7 +156,7 @@ namespace OCDI;
141
  </div>
142
  <?php endif; ?>
143
  <div class="ocdi__gl-item-container wp-clearfix js-ocdi-gl-item-container">
144
- <?php foreach ( $this->import_files as $index => $import_file ) : ?>
145
  <?php
146
  // Prepare import item display data.
147
  $img_src = isset( $import_file['import_preview_image_url'] ) ? $import_file['import_preview_image_url'] : '';
7
 
8
  namespace OCDI;
9
 
10
+ $predefined_themes = $this->import_files;
11
+
12
+ if ( ! empty( $this->import_files ) && isset( $_GET['import-mode'] ) && 'manual' === $_GET['import-mode'] ) {
13
+ $predefined_themes = array();
14
+ }
15
+
16
  ?>
17
 
18
  <div class="ocdi wrap about-wrap">
60
  <li><?php esc_html_e( 'Please click on the Import button only once and wait, it can take a couple of minutes.', 'pt-ocdi' ); ?></li>
61
  </ul>
62
 
63
+ <?php if ( ! empty( $this->import_files ) ) : ?>
64
+ <?php if ( empty( $_GET['import-mode'] ) || 'manual' !== $_GET['import-mode'] ) : ?>
65
+ <a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->plugin_page_setup['menu_slug'], 'import-mode' => 'manual' ), admin_url( $this->plugin_page_setup['parent_slug'] ) ) ); ?>" class="ocdi__import-mode-switch"><?php esc_html_e( 'Switch to manual import!', 'pt-ocdi' ); ?></a>
66
+ <?php else : ?>
67
+ <a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->plugin_page_setup['menu_slug'] ), admin_url( $this->plugin_page_setup['parent_slug'] ) ) ); ?>" class="ocdi__import-mode-switch"><?php esc_html_e( 'Switch back to theme predefined imports!', 'pt-ocdi' ); ?></a>
68
+ <?php endif; ?>
69
+ <?php endif; ?>
70
+
71
  <hr>
72
  </div>
73
 
78
  echo wp_kses_post( apply_filters( 'pt-ocdi/plugin_intro_text', $plugin_intro_text ) );
79
  ?>
80
 
 
81
  <?php if ( empty( $this->import_files ) ) : ?>
 
82
  <div class="notice notice-info is-dismissible">
83
  <p><?php esc_html_e( 'There are no predefined import files available in this theme. Please upload the import files manually!', 'pt-ocdi' ); ?></p>
84
  </div>
85
+ <?php endif; ?>
86
+
87
+ <?php if ( empty( $predefined_themes ) ) : ?>
88
 
89
  <div class="ocdi__file-upload-container">
90
  <h2><?php esc_html_e( 'Manual demo files upload', 'pt-ocdi' ); ?></h2>
120
  <button class="ocdi__button button button-hero button-primary js-ocdi-import-data"><?php esc_html_e( 'Import Demo Data', 'pt-ocdi' ); ?></button>
121
  </p>
122
 
123
+ <?php elseif ( 1 === count( $predefined_themes ) ) : ?>
124
 
125
  <div class="ocdi__demo-import-notice js-ocdi-demo-import-notice"><?php
126
+ if ( is_array( $predefined_themes ) && ! empty( $predefined_themes[0]['import_notice'] ) ) {
127
+ echo wp_kses_post( $predefined_themes[0]['import_notice'] );
128
  }
129
  ?></div>
130
 
138
  <div class="ocdi__gl js-ocdi-gl">
139
  <?php
140
  // Prepare navigation data.
141
+ $categories = Helpers::get_all_demo_import_categories( $predefined_themes );
142
  ?>
143
  <?php if ( ! empty( $categories ) ) : ?>
144
  <div class="ocdi__gl-header js-ocdi-gl-header">
156
  </div>
157
  <?php endif; ?>
158
  <div class="ocdi__gl-item-container wp-clearfix js-ocdi-gl-item-container">
159
+ <?php foreach ( $predefined_themes as $index => $import_file ) : ?>
160
  <?php
161
  // Prepare import item display data.
162
  $img_src = isset( $import_file['import_preview_image_url'] ) ? $import_file['import_preview_image_url'] : '';