One Click Demo Import - Version 2.2.1

Version Description

Release Date - 3 April 2017

  • Fix image importing error for server compressed files,
  • Fix remapping of featured images,
  • Fix custom post type existing posts check (no more multiple imports for custom post types).
Download this release

Release Info

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

Code changes from version 2.2.0 to 2.2.1

inc/OneClickDemoImport.php CHANGED
@@ -379,7 +379,7 @@ class OneClickDemoImport {
379
  $response['message'] = '';
380
 
381
  if ( ! apply_filters( 'pt-ocdi/disable_pt_branding', false ) ) {
382
- $twitter_status = esc_html__( 'Just used One Click Demo Import plugin and it was awesome! Thanks @ProteusThemes! https://www.proteusthemes.com/', 'pt-ocdi' );
383
 
384
  $response['message'] .= sprintf(
385
  __( '%1$s%6$sWasn\'t this a great One Click Demo Import experience?%7$s Created and maintained by %3$sProteusThemes%4$s. %2$s%5$sClick to Tweet!%4$s%8$s', 'pt-ocdi' ),
379
  $response['message'] = '';
380
 
381
  if ( ! apply_filters( 'pt-ocdi/disable_pt_branding', false ) ) {
382
+ $twitter_status = esc_html__( 'Just used One Click Demo Import plugin and it was awesome! Thanks @ProteusThemes! #OCDI https://www.proteusthemes.com/', 'pt-ocdi' );
383
 
384
  $response['message'] .= sprintf(
385
  __( '%1$s%6$sWasn\'t this a great One Click Demo Import experience?%7$s Created and maintained by %3$sProteusThemes%4$s. %2$s%5$sClick to Tweet!%4$s%8$s', 'pt-ocdi' ),
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.1.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"
@@ -198,7 +198,7 @@ msgstr ""
198
  #: inc/OneClickDemoImport.php:382
199
  msgid ""
200
  "Just used One Click Demo Import plugin and it was awesome! Thanks "
201
- "@ProteusThemes! https://www.proteusthemes.com/"
202
  msgstr ""
203
 
204
  #: inc/OneClickDemoImport.php:385
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"
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
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.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.2.1
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
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
4
  Requires at least: 4.0.0
5
  Tested up to: 4.7
6
- Stable tag: 2.2.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.
@@ -340,6 +340,14 @@ Please visit this [docs page](https://github.com/proteusthemes/one-click-demo-im
340
 
341
  == Changelog ==
342
 
 
 
 
 
 
 
 
 
343
  = 2.2.0 =
344
 
345
  *Release Date - 5 February 2017*
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.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.
340
 
341
  == Changelog ==
342
 
343
+ = 2.2.1 =
344
+
345
+ *Release Date - 3 April 2017*
346
+
347
+ * Fix image importing error for server compressed files,
348
+ * Fix remapping of featured images,
349
+ * Fix custom post type existing posts check (no more multiple imports for custom post types).
350
+
351
  = 2.2.0 =
352
 
353
  *Release Date - 5 February 2017*
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit053e42852cc588fef1cd3496856ef339::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit06f9575de8b884f593be69967ce35df0::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -374,9 +374,13 @@ class ClassLoader
374
 
375
  $first = $class[0];
376
  if (isset($this->prefixLengthsPsr4[$first])) {
377
- foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
378
- if (0 === strpos($class, $prefix)) {
379
- foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
 
 
 
 
380
  if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
381
  return $file;
382
  }
374
 
375
  $first = $class[0];
376
  if (isset($this->prefixLengthsPsr4[$first])) {
377
+ $subPath = $class;
378
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
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
  }
vendor/composer/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
 
2
- Copyright (c) 2016 Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
1
 
2
+ Copyright (c) Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit053e42852cc588fef1cd3496856ef339
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit053e42852cc588fef1cd3496856ef339
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit053e42852cc588fef1cd3496856ef339', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit053e42852cc588fef1cd3496856ef339', '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\ComposerStaticInit053e42852cc588fef1cd3496856ef339::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 ComposerAutoloaderInit06f9575de8b884f593be69967ce35df0
6
  {
7
  private static $loader;
8
 
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) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit053e42852cc588fef1cd3496856ef339
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -31,8 +31,8 @@ class ComposerStaticInit053e42852cc588fef1cd3496856ef339
31
  public static function getInitializer(ClassLoader $loader)
32
  {
33
  return \Closure::bind(function () use ($loader) {
34
- $loader->prefixLengthsPsr4 = ComposerStaticInit053e42852cc588fef1cd3496856ef339::$prefixLengthsPsr4;
35
- $loader->prefixDirsPsr4 = ComposerStaticInit053e42852cc588fef1cd3496856ef339::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit06f9575de8b884f593be69967ce35df0
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 = ComposerStaticInit06f9575de8b884f593be69967ce35df0::$prefixLengthsPsr4;
35
+ $loader->prefixDirsPsr4 = ComposerStaticInit06f9575de8b884f593be69967ce35df0::$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.3",
5
- "version_normalized": "0.4.3.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/proteusthemes/WordPress-Importer.git",
9
- "reference": "12dec5c810950f7d58d5a11dd1420a57830a0b1f"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/proteusthemes/WordPress-Importer/zipball/12dec5c810950f7d58d5a11dd1420a57830a0b1f",
14
- "reference": "12dec5c810950f7d58d5a11dd1420a57830a0b1f",
15
  "shasum": ""
16
  },
17
- "time": "2017-02-05T08:20:49+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.3"
45
  }
46
  }
47
  ]
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
  "wp"
42
  ],
43
  "support": {
44
+ "source": "https://github.com/proteusthemes/WordPress-Importer/tree/v0.4.6"
45
  }
46
  }
47
  ]
vendor/proteusthemes/wp-content-importer-v2/src/WXRImporter.php CHANGED
@@ -475,7 +475,8 @@ class WXRImporter extends \WP_Importer {
475
  if ( $this->options['aggressive_url_search'] ) {
476
  $this->replace_attachment_urls_in_content();
477
  }
478
- // $this->remap_featured_images();
 
479
 
480
  $this->import_end();
481
  }
@@ -1902,10 +1903,14 @@ class WXRImporter extends \WP_Importer {
1902
  $filesize = filesize( $upload['file'] );
1903
  $headers = wp_remote_retrieve_headers( $response );
1904
 
1905
- if ( isset( $headers['content-length'] ) && $filesize !== (int) $headers['content-length'] ) {
1906
- unlink( $upload['file'] );
1907
- return new \WP_Error( 'import_file_error', __( 'Remote file is incorrect size', 'wordpress-importer' ) );
1908
- }
 
 
 
 
1909
 
1910
  if ( 0 === $filesize ) {
1911
  unlink( $upload['file'] );
@@ -2257,13 +2262,21 @@ class WXRImporter extends \WP_Importer {
2257
  * Update _thumbnail_id meta to new, imported attachment IDs
2258
  */
2259
  function remap_featured_images() {
2260
- // cycle through posts that have a featured image
 
 
 
 
 
 
2261
  foreach ( $this->featured_images as $post_id => $value ) {
2262
- if ( isset( $this->processed_posts[ $value ] ) ) {
2263
- $new_id = $this->processed_posts[ $value ];
2264
 
2265
- // only update if there's a difference
2266
  if ( $new_id !== $value ) {
 
 
2267
  update_post_meta( $post_id, '_thumbnail_id', $new_id );
2268
  }
2269
  }
@@ -2343,6 +2356,8 @@ class WXRImporter extends \WP_Importer {
2343
  $exists_key = $data['guid'];
2344
 
2345
  if ( $this->options['prefill_existing_posts'] ) {
 
 
2346
  return isset( $this->exists['post'][ $exists_key ] ) ? $this->exists['post'][ $exists_key ] : false;
2347
  }
2348
 
475
  if ( $this->options['aggressive_url_search'] ) {
476
  $this->replace_attachment_urls_in_content();
477
  }
478
+
479
+ $this->remap_featured_images();
480
 
481
  $this->import_end();
482
  }
1903
  $filesize = filesize( $upload['file'] );
1904
  $headers = wp_remote_retrieve_headers( $response );
1905
 
1906
+ // OCDI fix!
1907
+ // Smaller images with server compression do not pass this rule.
1908
+ // More info here: https://github.com/proteusthemes/WordPress-Importer/pull/2
1909
+ //
1910
+ // if ( isset( $headers['content-length'] ) && $filesize !== (int) $headers['content-length'] ) {
1911
+ // unlink( $upload['file'] );
1912
+ // return new \WP_Error( 'import_file_error', __( 'Remote file is incorrect size', 'wordpress-importer' ) );
1913
+ // }
1914
 
1915
  if ( 0 === $filesize ) {
1916
  unlink( $upload['file'] );
2262
  * Update _thumbnail_id meta to new, imported attachment IDs
2263
  */
2264
  function remap_featured_images() {
2265
+ if ( empty( $this->featured_images ) ) {
2266
+ return;
2267
+ }
2268
+
2269
+ $this->logger->info( esc_html__( 'Starting remapping of featured images', 'wordpress-importer' ) );
2270
+
2271
+ // Cycle through posts that have a featured image.
2272
  foreach ( $this->featured_images as $post_id => $value ) {
2273
+ if ( isset( $this->mapping['post'][ $value ] ) ) {
2274
+ $new_id = $this->mapping['post'][ $value ];
2275
 
2276
+ // Only update if there's a difference.
2277
  if ( $new_id !== $value ) {
2278
+ $this->logger->info( sprintf( esc_html__( 'Remapping featured image ID %d to new ID %d for post ID %d', 'wordpress-importer' ), $value, $new_id, $post_id ) );
2279
+
2280
  update_post_meta( $post_id, '_thumbnail_id', $new_id );
2281
  }
2282
  }
2356
  $exists_key = $data['guid'];
2357
 
2358
  if ( $this->options['prefill_existing_posts'] ) {
2359
+ // OCDI: fix for custom post types. The guids in the prefilled section are escaped, so these ones should be as well.
2360
+ $exists_key = htmlentities( $exists_key );
2361
  return isset( $this->exists['post'][ $exists_key ] ) ? $this->exists['post'][ $exists_key ] : false;
2362
  }
2363