One Click Demo Import - Version 2.5.2

Version Description

Release Date - 29 July 2019

  • Improved documentation and code sample
  • Added pt-ocdi/pre_download_import_files filter
  • Added two action hooks to plugin-page.php
  • Bumped Tested up to tag
Download this release

Release Info

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

Code changes from version 2.5.1 to 2.5.2

inc/Helpers.php CHANGED
@@ -67,6 +67,8 @@ class Helpers {
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.
72
  if ( empty( $import_file_info['import_file_url'] ) ) {
67
  );
68
  $downloader = new Downloader();
69
 
70
+ $import_file_info = apply_filters('pt-ocdi/pre_download_import_files', $import_file_info);
71
+
72
  // ----- Set content file path -----
73
  // Check if 'import_file_url' is not defined. That would mean a local file.
74
  if ( empty( $import_file_info['import_file_url'] ) ) {
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.5.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.5.2
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, 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.5.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.
@@ -128,7 +128,7 @@ function ocdi_after_import_setup() {
128
  $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
129
 
130
  set_theme_mod( 'nav_menu_locations', array(
131
- 'main-menu' => $main_menu->term_id,
132
  )
133
  );
134
 
@@ -339,6 +339,37 @@ You can disable the branding notice with a WP filter. All you need to do is add
339
 
340
  and the notice will not be displayed.
341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
 
343
  = I can't activate the plugin, because of a fatal error, what can I do? =
344
 
@@ -362,6 +393,15 @@ Please visit this [docs page](https://github.com/proteusthemes/one-click-demo-im
362
 
363
  == Changelog ==
364
 
 
 
 
 
 
 
 
 
 
365
  = 2.5.1 =
366
 
367
  *Release Date - 25 October 2018*
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: 5.2.2
6
+ Stable tag: 2.5.2
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.
128
  $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
129
 
130
  set_theme_mod( 'nav_menu_locations', array(
131
+ 'main-menu' => $main_menu->term_id, // replace 'main-menu' here with the menu location identifier from register_nav_menu() function
132
  )
133
  );
134
 
339
 
340
  and the notice will not be displayed.
341
 
342
+ = How can I pass Amazon S3 presigned URL's (temporary links) as external files ? =
343
+
344
+ If you want to host your import content files on Amazon S3, but you want them to be publicly available, rather through an own API as presigned URL's (which expires) you can use the filter `pt-ocdi/pre_download_import_files` in which you can pass your own URL's, for example:
345
+
346
+ ```
347
+ add_filter( 'pt-ocdi/pre_download_import_files', function( $import_file_info ){
348
+
349
+ // In this example `get_my_custom_urls` is supposedly making a `wp_remote_get` request, getting the urls from an API server where you're creating the presigned urls, [example here](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-presigned-url.html).
350
+ // This request should return an array containing all the 3 links - `import_file_url`, `import_widget_file_url`, `import_customizer_file_url`
351
+ $request = get_my_custom_urls( $import_file_info );
352
+
353
+ if ( !is_wp_error( $request ) )
354
+ {
355
+ if ( isset($request['data']) && is_array($request['data']) )
356
+ {
357
+ if( isset($request['data']['import_file_url']) && $import_file_url = $request['data']['import_file_url'] ){
358
+ $import_file_info['import_file_url'] = $import_file_url;
359
+ }
360
+ if( isset($request['data']['import_widget_file_url']) && $import_widget_file_url = $request['data']['import_widget_file_url'] ){
361
+ $import_file_info['import_widget_file_url'] = $import_widget_file_url;
362
+ }
363
+ if( isset($request['data']['import_customizer_file_url']) && $import_customizer_file_url = $request['data']['import_customizer_file_url'] ){
364
+ $import_file_info['import_customizer_file_url'] = $import_customizer_file_url;
365
+ }
366
+ }
367
+ }
368
+
369
+ return $import_file_info;
370
+
371
+ } );
372
+ ```
373
 
374
  = I can't activate the plugin, because of a fatal error, what can I do? =
375
 
393
 
394
  == Changelog ==
395
 
396
+ = 2.5.2 =
397
+
398
+ *Release Date - 29 July 2019*
399
+
400
+ * Improved documentation and code sample
401
+ * Added `pt-ocdi/pre_download_import_files` filter
402
+ * Added two action hooks to plugin-page.php
403
+ * Bumped `Tested up to` tag
404
+
405
  = 2.5.1 =
406
 
407
  *Release Date - 25 October 2018*
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInite67535fe8bb9e847195ca18c8c330d4f::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit1dc3b7695346d0ca54da2c4b66963a38::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -279,7 +279,7 @@ class ClassLoader
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
282
- $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
  }
284
 
285
  /**
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283
  }
284
 
285
  /**
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInite67535fe8bb9e847195ca18c8c330d4f
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInite67535fe8bb9e847195ca18c8c330d4f
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInite67535fe8bb9e847195ca18c8c330d4f', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInite67535fe8bb9e847195ca18c8c330d4f', '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\ComposerStaticInite67535fe8bb9e847195ca18c8c330d4f::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 ComposerAutoloaderInit1dc3b7695346d0ca54da2c4b66963a38
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit1dc3b7695346d0ca54da2c4b66963a38', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit1dc3b7695346d0ca54da2c4b66963a38', '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\ComposerStaticInit1dc3b7695346d0ca54da2c4b66963a38::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 ComposerStaticInite67535fe8bb9e847195ca18c8c330d4f
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -31,8 +31,8 @@ class ComposerStaticInite67535fe8bb9e847195ca18c8c330d4f
31
  public static function getInitializer(ClassLoader $loader)
32
  {
33
  return \Closure::bind(function () use ($loader) {
34
- $loader->prefixLengthsPsr4 = ComposerStaticInite67535fe8bb9e847195ca18c8c330d4f::$prefixLengthsPsr4;
35
- $loader->prefixDirsPsr4 = ComposerStaticInite67535fe8bb9e847195ca18c8c330d4f::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit1dc3b7695346d0ca54da2c4b66963a38
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 = ComposerStaticInit1dc3b7695346d0ca54da2c4b66963a38::$prefixLengthsPsr4;
35
+ $loader->prefixDirsPsr4 = ComposerStaticInit1dc3b7695346d0ca54da2c4b66963a38::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }
views/plugin-page.php CHANGED
@@ -13,6 +13,10 @@ if ( ! empty( $this->import_files ) && isset( $_GET['import-mode'] ) && 'manual'
13
  $predefined_themes = array();
14
  }
15
 
 
 
 
 
16
  ?>
17
 
18
  <div class="ocdi wrap about-wrap">
@@ -197,3 +201,9 @@ if ( ! empty( $this->import_files ) && isset( $_GET['import-mode'] ) && 'manual'
197
 
198
  <div class="ocdi__response js-ocdi-ajax-response"></div>
199
  </div>
 
 
 
 
 
 
13
  $predefined_themes = array();
14
  }
15
 
16
+ /**
17
+ * Hook for adding the custom plugin page header
18
+ */
19
+ do_action( 'pt-ocdi/plugin_page_header' );
20
  ?>
21
 
22
  <div class="ocdi wrap about-wrap">
201
 
202
  <div class="ocdi__response js-ocdi-ajax-response"></div>
203
  </div>
204
+
205
+ <?php
206
+ /**
207
+ * Hook for adding the custom admin page footer
208
+ */
209
+ do_action( 'pt-ocdi/plugin_page_footer' );