One Click Demo Import - Version 1.4.0

Version Description

Release Date - 29 October 2016

  • Add support for WP term meta data in content importer,
  • Fix the issue of having both plugins (OCDI and the new WP importer v2) activated at the same time.
Download this release

Release Info

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

Code changes from version 1.3.0 to 1.4.0

inc/class-ocdi-logger.php CHANGED
@@ -5,15 +5,7 @@
5
  * @package ocdi
6
  */
7
 
8
- // Include required files, if not already present (via separate plugin).
9
- if ( ! class_exists( 'WP_Importer_Logger' ) ) {
10
- require PT_OCDI_PATH . 'vendor/humanmade/WordPress-Importer/class-logger.php';
11
- }
12
- if ( ! class_exists( 'WP_Importer_Logger_CLI' ) ) {
13
- require PT_OCDI_PATH . 'vendor/humanmade/WordPress-Importer/class-logger-cli.php';
14
- }
15
-
16
- class OCDI_Logger extends WP_Importer_Logger_CLI {
17
 
18
  /**
19
  * Variable for front-end error display.
5
  * @package ocdi
6
  */
7
 
8
+ class OCDI_Logger extends ProteusThemes\WPContentImporter2\WPImporterLoggerCLI {
 
 
 
 
 
 
 
 
9
 
10
  /**
11
  * Variable for front-end error display.
inc/class-ocdi-wxr-importer.php CHANGED
@@ -7,12 +7,7 @@
7
  * @package ocdi
8
  */
9
 
10
- // Include required files, if not already present (via separate plugin).
11
- if ( ! class_exists( 'WXR_Importer' ) ) {
12
- require PT_OCDI_PATH . 'vendor/humanmade/WordPress-Importer/class-wxr-importer.php';
13
- }
14
-
15
- class OCDI_WXR_Importer extends WXR_Importer {
16
 
17
  public function __construct( $options = array() ) {
18
  parent::__construct( $options );
7
  * @package ocdi
8
  */
9
 
10
+ class OCDI_WXR_Importer extends ProteusThemes\WPContentImporter2\WXRImporter {
 
 
 
 
 
11
 
12
  public function __construct( $options = array() ) {
13
  parent::__construct( $options );
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 1.2.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"
2
  # This file is distributed under the GPL 2.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: One Click Demo Import 1.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"
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: 1.3.0
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
@@ -35,12 +35,15 @@ if ( version_compare( phpversion(), '5.3.2', '<' ) ) {
35
  else {
36
 
37
  // Current version of the plugin.
38
- define( 'PT_OCDI_VERSION', '1.3.0' );
39
 
40
  // Path/URL to root of this plugin, with trailing slash.
41
  define( 'PT_OCDI_PATH', plugin_dir_path( __FILE__ ) );
42
  define( 'PT_OCDI_URL', plugin_dir_url( __FILE__ ) );
43
 
 
 
 
44
  // Require main plugin file.
45
  require PT_OCDI_PATH . 'inc/class-ocdi-main.php';
46
 
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: 1.4.0
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
35
  else {
36
 
37
  // Current version of the plugin.
38
+ define( 'PT_OCDI_VERSION', '1.4.0' );
39
 
40
  // Path/URL to root of this plugin, with trailing slash.
41
  define( 'PT_OCDI_PATH', plugin_dir_path( __FILE__ ) );
42
  define( 'PT_OCDI_URL', plugin_dir_url( __FILE__ ) );
43
 
44
+ // Composer autoloader.
45
+ require_once PT_OCDI_PATH . 'vendor/autoload.php';
46
+
47
  // Require main plugin file.
48
  require PT_OCDI_PATH . 'inc/class-ocdi-main.php';
49
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: capuderg, cyman
3
  Tags: import, content, demo, data, widgets, settings
4
  Requires at least: 4.0.0
5
  Tested up to: 4.6
6
- Stable tag: 1.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.
@@ -242,6 +242,13 @@ Please visit this [docs page](https://github.com/proteusthemes/one-click-demo-im
242
 
243
  == Changelog ==
244
 
 
 
 
 
 
 
 
245
  = 1.3.0 =
246
 
247
  *Release Date - 1 October 2016*
3
  Tags: import, content, demo, data, widgets, settings
4
  Requires at least: 4.0.0
5
  Tested up to: 4.6
6
+ Stable tag: 1.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.
242
 
243
  == Changelog ==
244
 
245
+ = 1.4.0 =
246
+
247
+ *Release Date - 29 October 2016*
248
+
249
+ * Add support for WP term meta data in content importer,
250
+ * Fix the issue of having both plugins (OCDI and the new WP importer v2) activated at the same time.
251
+
252
  = 1.3.0 =
253
 
254
  *Release Date - 1 October 2016*
vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit3386d3451f83bf87ed4e429dad5a4f19::getLoader();
vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+
59
+ public function getPrefixes()
60
+ {
61
+ if (!empty($this->prefixesPsr0)) {
62
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
63
+ }
64
+
65
+ return array();
66
+ }
67
+
68
+ public function getPrefixesPsr4()
69
+ {
70
+ return $this->prefixDirsPsr4;
71
+ }
72
+
73
+ public function getFallbackDirs()
74
+ {
75
+ return $this->fallbackDirsPsr0;
76
+ }
77
+
78
+ public function getFallbackDirsPsr4()
79
+ {
80
+ return $this->fallbackDirsPsr4;
81
+ }
82
+
83
+ public function getClassMap()
84
+ {
85
+ return $this->classMap;
86
+ }
87
+
88
+ /**
89
+ * @param array $classMap Class to filename map
90
+ */
91
+ public function addClassMap(array $classMap)
92
+ {
93
+ if ($this->classMap) {
94
+ $this->classMap = array_merge($this->classMap, $classMap);
95
+ } else {
96
+ $this->classMap = $classMap;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Registers a set of PSR-0 directories for a given prefix, either
102
+ * appending or prepending to the ones previously set for this prefix.
103
+ *
104
+ * @param string $prefix The prefix
105
+ * @param array|string $paths The PSR-0 root directories
106
+ * @param bool $prepend Whether to prepend the directories
107
+ */
108
+ public function add($prefix, $paths, $prepend = false)
109
+ {
110
+ if (!$prefix) {
111
+ if ($prepend) {
112
+ $this->fallbackDirsPsr0 = array_merge(
113
+ (array) $paths,
114
+ $this->fallbackDirsPsr0
115
+ );
116
+ } else {
117
+ $this->fallbackDirsPsr0 = array_merge(
118
+ $this->fallbackDirsPsr0,
119
+ (array) $paths
120
+ );
121
+ }
122
+
123
+ return;
124
+ }
125
+
126
+ $first = $prefix[0];
127
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+
130
+ return;
131
+ }
132
+ if ($prepend) {
133
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
134
+ (array) $paths,
135
+ $this->prefixesPsr0[$first][$prefix]
136
+ );
137
+ } else {
138
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
139
+ $this->prefixesPsr0[$first][$prefix],
140
+ (array) $paths
141
+ );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Registers a set of PSR-4 directories for a given namespace, either
147
+ * appending or prepending to the ones previously set for this namespace.
148
+ *
149
+ * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-4 base directories
151
+ * @param bool $prepend Whether to prepend the directories
152
+ *
153
+ * @throws \InvalidArgumentException
154
+ */
155
+ public function addPsr4($prefix, $paths, $prepend = false)
156
+ {
157
+ if (!$prefix) {
158
+ // Register directories for the root namespace.
159
+ if ($prepend) {
160
+ $this->fallbackDirsPsr4 = array_merge(
161
+ (array) $paths,
162
+ $this->fallbackDirsPsr4
163
+ );
164
+ } else {
165
+ $this->fallbackDirsPsr4 = array_merge(
166
+ $this->fallbackDirsPsr4,
167
+ (array) $paths
168
+ );
169
+ }
170
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+ // Register directories for a new namespace.
172
+ $length = strlen($prefix);
173
+ if ('\\' !== $prefix[$length - 1]) {
174
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
+ }
176
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+ } elseif ($prepend) {
179
+ // Prepend directories for an already registered namespace.
180
+ $this->prefixDirsPsr4[$prefix] = array_merge(
181
+ (array) $paths,
182
+ $this->prefixDirsPsr4[$prefix]
183
+ );
184
+ } else {
185
+ // Append directories for an already registered namespace.
186
+ $this->prefixDirsPsr4[$prefix] = array_merge(
187
+ $this->prefixDirsPsr4[$prefix],
188
+ (array) $paths
189
+ );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Registers a set of PSR-0 directories for a given prefix,
195
+ * replacing any others previously set for this prefix.
196
+ *
197
+ * @param string $prefix The prefix
198
+ * @param array|string $paths The PSR-0 base directories
199
+ */
200
+ public function set($prefix, $paths)
201
+ {
202
+ if (!$prefix) {
203
+ $this->fallbackDirsPsr0 = (array) $paths;
204
+ } else {
205
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Registers a set of PSR-4 directories for a given namespace,
211
+ * replacing any others previously set for this namespace.
212
+ *
213
+ * @param string $prefix The prefix/namespace, with trailing '\\'
214
+ * @param array|string $paths The PSR-4 base directories
215
+ *
216
+ * @throws \InvalidArgumentException
217
+ */
218
+ public function setPsr4($prefix, $paths)
219
+ {
220
+ if (!$prefix) {
221
+ $this->fallbackDirsPsr4 = (array) $paths;
222
+ } else {
223
+ $length = strlen($prefix);
224
+ if ('\\' !== $prefix[$length - 1]) {
225
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
+ }
227
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Turns on searching the include path for class files.
234
+ *
235
+ * @param bool $useIncludePath
236
+ */
237
+ public function setUseIncludePath($useIncludePath)
238
+ {
239
+ $this->useIncludePath = $useIncludePath;
240
+ }
241
+
242
+ /**
243
+ * Can be used to check if the autoloader uses the include path to check
244
+ * for classes.
245
+ *
246
+ * @return bool
247
+ */
248
+ public function getUseIncludePath()
249
+ {
250
+ return $this->useIncludePath;
251
+ }
252
+
253
+ /**
254
+ * Turns off searching the prefix and fallback directories for classes
255
+ * that have not been registered with the class map.
256
+ *
257
+ * @param bool $classMapAuthoritative
258
+ */
259
+ public function setClassMapAuthoritative($classMapAuthoritative)
260
+ {
261
+ $this->classMapAuthoritative = $classMapAuthoritative;
262
+ }
263
+
264
+ /**
265
+ * Should class lookup fail if not found in the current class map?
266
+ *
267
+ * @return bool
268
+ */
269
+ public function isClassMapAuthoritative()
270
+ {
271
+ return $this->classMapAuthoritative;
272
+ }
273
+
274
+ /**
275
+ * Registers this instance as an autoloader.
276
+ *
277
+ * @param bool $prepend Whether to prepend the autoloader or not
278
+ */
279
+ public function register($prepend = false)
280
+ {
281
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
+ }
283
+
284
+ /**
285
+ * Unregisters this instance as an autoloader.
286
+ */
287
+ public function unregister()
288
+ {
289
+ spl_autoload_unregister(array($this, 'loadClass'));
290
+ }
291
+
292
+ /**
293
+ * Loads the given class or interface.
294
+ *
295
+ * @param string $class The name of the class
296
+ * @return bool|null True if loaded, null otherwise
297
+ */
298
+ public function loadClass($class)
299
+ {
300
+ if ($file = $this->findFile($class)) {
301
+ includeFile($file);
302
+
303
+ return true;
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Finds the path to the file where the class is defined.
309
+ *
310
+ * @param string $class The name of the class
311
+ *
312
+ * @return string|false The path if found, false otherwise
313
+ */
314
+ public function findFile($class)
315
+ {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
+ // class map lookup
322
+ if (isset($this->classMap[$class])) {
323
+ return $this->classMap[$class];
324
+ }
325
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
326
+ return false;
327
+ }
328
+
329
+ $file = $this->findFileWithExtension($class, '.php');
330
+
331
+ // Search for Hack files if we are running on HHVM
332
+ if (false === $file && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if (false === $file) {
337
+ // Remember that this class does not exist.
338
+ $this->missingClasses[$class] = true;
339
+ }
340
+
341
+ return $file;
342
+ }
343
+
344
+ private function findFileWithExtension($class, $ext)
345
+ {
346
+ // PSR-4 lookup
347
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
+
349
+ $first = $class[0];
350
+ if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
+ return $file;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ // PSR-4 fallback dirs
363
+ foreach ($this->fallbackDirsPsr4 as $dir) {
364
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
+ return $file;
366
+ }
367
+ }
368
+
369
+ // PSR-0 lookup
370
+ if (false !== $pos = strrpos($class, '\\')) {
371
+ // namespaced class name
372
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
+ } else {
375
+ // PEAR-like class name
376
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
+ }
378
+
379
+ if (isset($this->prefixesPsr0[$first])) {
380
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
+ if (0 === strpos($class, $prefix)) {
382
+ foreach ($dirs as $dir) {
383
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
+ return $file;
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ // PSR-0 fallback dirs
392
+ foreach ($this->fallbackDirsPsr0 as $dir) {
393
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
+ return $file;
395
+ }
396
+ }
397
+
398
+ // PSR-0 include paths.
399
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
+ return $file;
401
+ }
402
+
403
+ return false;
404
+ }
405
+ }
406
+
407
+ /**
408
+ * Scope isolated include.
409
+ *
410
+ * Prevents access to $this/self from included files.
411
+ */
412
+ function includeFile($file)
413
+ {
414
+ include $file;
415
+ }
vendor/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'ProteusThemes\\WPContentImporter2\\' => array($vendorDir . '/proteusthemes/wp-content-importer-v2/src'),
10
+ );
vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit3386d3451f83bf87ed4e429dad5a4f19
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit3386d3451f83bf87ed4e429dad5a4f19', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit3386d3451f83bf87ed4e429dad5a4f19', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit3386d3451f83bf87ed4e429dad5a4f19::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
+ }
47
+
48
+ $loader->register(true);
49
+
50
+ return $loader;
51
+ }
52
+ }
vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit3386d3451f83bf87ed4e429dad5a4f19
8
+ {
9
+ public static $prefixLengthsPsr4 = array (
10
+ 'P' =>
11
+ array (
12
+ 'ProteusThemes\\WPContentImporter2\\' => 33,
13
+ ),
14
+ );
15
+
16
+ public static $prefixDirsPsr4 = array (
17
+ 'ProteusThemes\\WPContentImporter2\\' =>
18
+ array (
19
+ 0 => __DIR__ . '/..' . '/proteusthemes/wp-content-importer-v2/src',
20
+ ),
21
+ );
22
+
23
+ public static function getInitializer(ClassLoader $loader)
24
+ {
25
+ return \Closure::bind(function () use ($loader) {
26
+ $loader->prefixLengthsPsr4 = ComposerStaticInit3386d3451f83bf87ed4e429dad5a4f19::$prefixLengthsPsr4;
27
+ $loader->prefixDirsPsr4 = ComposerStaticInit3386d3451f83bf87ed4e429dad5a4f19::$prefixDirsPsr4;
28
+
29
+ }, null, ClassLoader::class);
30
+ }
31
+ }
vendor/composer/installed.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "proteusthemes/wp-content-importer-v2",
4
+ "version": "v0.2.0",
5
+ "version_normalized": "0.2.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/proteusthemes/WordPress-Importer.git",
9
+ "reference": "d0f410cfe3921cab85682dfbccfaccbcdf7d9672"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/proteusthemes/WordPress-Importer/zipball/d0f410cfe3921cab85682dfbccfaccbcdf7d9672",
14
+ "reference": "d0f410cfe3921cab85682dfbccfaccbcdf7d9672",
15
+ "shasum": ""
16
+ },
17
+ "time": "2016-10-29 11:19:31",
18
+ "type": "library",
19
+ "installation-source": "source",
20
+ "autoload": {
21
+ "psr-4": {
22
+ "ProteusThemes\\WPContentImporter2\\": "src/"
23
+ }
24
+ },
25
+ "license": [
26
+ "GPL-2.0+"
27
+ ],
28
+ "authors": [
29
+ {
30
+ "name": "Contributors",
31
+ "homepage": "https://github.com/humanmade/WordPress-Importer/graphs/contributors"
32
+ }
33
+ ],
34
+ "description": "WP content importer v2 forked from humanmade/wordpress-importer.",
35
+ "keywords": [
36
+ "content",
37
+ "import",
38
+ "proteusthemes",
39
+ "theme",
40
+ "wordpress",
41
+ "wp"
42
+ ],
43
+ "support": {
44
+ "source": "https://github.com/proteusthemes/WordPress-Importer/tree/v0.2.0"
45
+ }
46
+ }
47
+ ]
vendor/proteusthemes/wp-content-importer-v2/README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WP content importer used in OCDI
2
+
3
+ List of files used in OCDI plugin (from the original repo):
4
+
5
+ - class-logger-cli.php,
6
+ - class-logger.php,
7
+ - class-wxr-importer.php
8
+
9
+
10
+ One click demo import plugin page: https://wordpress.org/plugins/one-click-demo-import/
11
+
12
+ One click demo import github page: https://github.com/proteusthemes/one-click-demo-import
13
+
14
+
15
+ ## Changelog
16
+
17
+ *October 29th 2016*
18
+
19
+ - Cleaned up this forked repo, to only include the thing we need in the OCDI plugin.
20
+ - Changed the class names and use psr-4 autoloading in composer.json
21
+
22
+ *October 26th 2016*
23
+
24
+ - made a fork form the original repo
25
+ - merged a pull request for "term meta data" from the original repo: https://github.com/humanmade/WordPress-Importer/pull/18
vendor/proteusthemes/wp-content-importer-v2/composer.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "proteusthemes/wp-content-importer-v2",
3
+ "description": "WP content importer v2 forked from humanmade/wordpress-importer.",
4
+ "keywords": ["wp", "wordpress", "proteusthemes", "theme", "import", "content"],
5
+ "license": "GPL-2.0+",
6
+ "authors": [
7
+ {
8
+ "name" : "Contributors",
9
+ "homepage" : "https://github.com/humanmade/WordPress-Importer/graphs/contributors"
10
+ }
11
+ ],
12
+ "autoload": {
13
+ "psr-4": {
14
+ "ProteusThemes\\WPContentImporter2\\": "src/"
15
+ }
16
+ }
17
+ }
vendor/{humanmade/WordPress-Importer/class-logger.php → proteusthemes/wp-content-importer-v2/src/WPImporterLogger.php} RENAMED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  /**
4
  * Describes a logger instance
@@ -17,7 +18,7 @@
17
  * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
18
  * for the full interface specification.
19
  */
20
- class WP_Importer_Logger {
21
  /**
22
  * System is unusable.
23
  *
1
  <?php
2
+ namespace ProteusThemes\WPContentImporter2;
3
 
4
  /**
5
  * Describes a logger instance
18
  * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
19
  * for the full interface specification.
20
  */
21
+ class WPImporterLogger {
22
  /**
23
  * System is unusable.
24
  *
vendor/{humanmade/WordPress-Importer/class-logger-cli.php → proteusthemes/wp-content-importer-v2/src/WPImporterLoggerCLI.php} RENAMED
@@ -1,6 +1,7 @@
1
  <?php
 
2
 
3
- class WP_Importer_Logger_CLI extends WP_Importer_Logger {
4
  public $min_level = 'notice';
5
 
6
  /**
1
  <?php
2
+ namespace ProteusThemes\WPContentImporter2;
3
 
4
+ class WPImporterLoggerCLI extends WPImporterLogger {
5
  public $min_level = 'notice';
6
 
7
  /**
vendor/proteusthemes/wp-content-importer-v2/src/WXRImportInfo.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace ProteusThemes\WPContentImporter2;
4
+
5
+ class WXRImportInfo {
6
+ public $home;
7
+ public $siteurl;
8
+ public $title;
9
+ public $users = array();
10
+ public $post_count = 0;
11
+ public $media_count = 0;
12
+ public $comment_count = 0;
13
+ public $term_count = 0;
14
+ public $generator = '';
15
+ public $version;
16
+ }
vendor/{humanmade/WordPress-Importer/class-wxr-importer.php → proteusthemes/wp-content-importer-v2/src/WXRImporter.php} RENAMED
@@ -1,6 +1,7 @@
1
  <?php
 
2
 
3
- class WXR_Importer extends WP_Importer {
4
  /**
5
  * Maximum supported WXR version
6
  */
@@ -119,7 +120,7 @@ class WXR_Importer extends WP_Importer {
119
  // $old_value = libxml_disable_entity_loader( true );
120
  }
121
 
122
- $reader = new XMLReader();
123
  $status = $reader->open( $file );
124
 
125
  if ( ! is_null( $old_value ) ) {
@@ -127,7 +128,7 @@ class WXR_Importer extends WP_Importer {
127
  }
128
 
129
  if ( ! $status ) {
130
- return new WP_Error( 'wxr_importer.cannot_parse', __( 'Could not open the file for parsing', 'wordpress-importer' ) );
131
  }
132
 
133
  return $reader;
@@ -149,10 +150,10 @@ class WXR_Importer extends WP_Importer {
149
  $this->version = '1.0';
150
 
151
  // Start parsing!
152
- $data = new WXR_Import_Info();
153
  while ( $reader->read() ) {
154
  // Only deal with element opens
155
- if ( $reader->nodeType !== XMLReader::ELEMENT ) {
156
  continue;
157
  }
158
 
@@ -268,7 +269,7 @@ class WXR_Importer extends WP_Importer {
268
  $authors = array();
269
  while ( $reader->read() ) {
270
  // Only deal with element opens
271
- if ( $reader->nodeType !== XMLReader::ELEMENT ) {
272
  continue;
273
  }
274
 
@@ -341,7 +342,7 @@ class WXR_Importer extends WP_Importer {
341
  // Start parsing!
342
  while ( $reader->read() ) {
343
  // Only deal with element opens
344
- if ( $reader->nodeType !== XMLReader::ELEMENT ) {
345
  continue;
346
  }
347
 
@@ -501,7 +502,7 @@ class WXR_Importer extends WP_Importer {
501
  */
502
  protected function import_start( $file ) {
503
  if ( ! is_file( $file ) ) {
504
- return new WP_Error( 'wxr_importer.file_missing', __( 'The file does not exist, please try again.', 'wordpress-importer' ) );
505
  }
506
 
507
  // Suspend bunches of stuff in WP core
@@ -660,7 +661,7 @@ class WXR_Importer extends WP_Importer {
660
 
661
  if ( $data['post_status'] === 'auto-draft' ) {
662
  // Bail now
663
- return new WP_Error(
664
  'wxr_importer.post.cannot_import_draft',
665
  __( 'Cannot import auto-draft posts' ),
666
  $data
@@ -1033,7 +1034,7 @@ class WXR_Importer extends WP_Importer {
1033
 
1034
  $info = wp_check_filetype( $upload['file'] );
1035
  if ( ! $info ) {
1036
- return new WP_Error( 'attachment_processing_error', __( 'Invalid file type', 'wordpress-importer' ) );
1037
  }
1038
 
1039
  $post['post_mime_type'] = $info['type'];
@@ -1602,6 +1603,11 @@ class WXR_Importer extends WP_Importer {
1602
  $key = array_search( $child->tagName, $tag_name );
1603
  if ( $key ) {
1604
  $data[ $key ] = $child->textContent;
 
 
 
 
 
1605
  }
1606
  }
1607
 
@@ -1712,6 +1718,8 @@ class WXR_Importer extends WP_Importer {
1712
  $term_id
1713
  ) );
1714
 
 
 
1715
  do_action( 'wp_import_insert_term', $term_id, $data );
1716
 
1717
  /**
@@ -1723,6 +1731,48 @@ class WXR_Importer extends WP_Importer {
1723
  do_action( 'wxr_importer.processed.term', $term_id, $data );
1724
  }
1725
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1726
  /**
1727
  * Attempt to download a remote file attachment
1728
  *
@@ -1737,7 +1787,7 @@ class WXR_Importer extends WP_Importer {
1737
  // get placeholder file in the upload dir with a unique, sanitized filename
1738
  $upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
1739
  if ( $upload['error'] ) {
1740
- return new WP_Error( 'upload_dir_error', $upload['error'] );
1741
  }
1742
 
1743
  // fetch the remote url and write it to the placeholder file
@@ -1757,7 +1807,7 @@ class WXR_Importer extends WP_Importer {
1757
  // make sure the fetch was successful
1758
  if ( $code !== 200 ) {
1759
  unlink( $upload['file'] );
1760
- return new WP_Error(
1761
  'import_file_error',
1762
  sprintf(
1763
  __( 'Remote server returned %1$d %2$s for %3$s', 'wordpress-importer' ),
@@ -1773,19 +1823,19 @@ class WXR_Importer extends WP_Importer {
1773
 
1774
  if ( isset( $headers['content-length'] ) && $filesize !== (int) $headers['content-length'] ) {
1775
  unlink( $upload['file'] );
1776
- return new WP_Error( 'import_file_error', __( 'Remote file is incorrect size', 'wordpress-importer' ) );
1777
  }
1778
 
1779
  if ( 0 === $filesize ) {
1780
  unlink( $upload['file'] );
1781
- return new WP_Error( 'import_file_error', __( 'Zero size file downloaded', 'wordpress-importer' ) );
1782
  }
1783
 
1784
  $max_size = (int) $this->max_attachment_size();
1785
  if ( ! empty( $max_size ) && $filesize > $max_size ) {
1786
  unlink( $upload['file'] );
1787
  $message = sprintf( __( 'Remote file is too large, limit is %s', 'wordpress-importer' ), size_format( $max_size ) );
1788
- return new WP_Error( 'import_file_error', $message );
1789
  }
1790
 
1791
  return $upload;
1
  <?php
2
+ namespace ProteusThemes\WPContentImporter2;
3
 
4
+ class WXRImporter extends \WP_Importer {
5
  /**
6
  * Maximum supported WXR version
7
  */
120
  // $old_value = libxml_disable_entity_loader( true );
121
  }
122
 
123
+ $reader = new \XMLReader();
124
  $status = $reader->open( $file );
125
 
126
  if ( ! is_null( $old_value ) ) {
128
  }
129
 
130
  if ( ! $status ) {
131
+ return new \WP_Error( 'wxr_importer.cannot_parse', __( 'Could not open the file for parsing', 'wordpress-importer' ) );
132
  }
133
 
134
  return $reader;
150
  $this->version = '1.0';
151
 
152
  // Start parsing!
153
+ $data = new WXRImportInfo();
154
  while ( $reader->read() ) {
155
  // Only deal with element opens
156
+ if ( $reader->nodeType !== \XMLReader::ELEMENT ) {
157
  continue;
158
  }
159
 
269
  $authors = array();
270
  while ( $reader->read() ) {
271
  // Only deal with element opens
272
+ if ( $reader->nodeType !== \XMLReader::ELEMENT ) {
273
  continue;
274
  }
275
 
342
  // Start parsing!
343
  while ( $reader->read() ) {
344
  // Only deal with element opens
345
+ if ( $reader->nodeType !== \XMLReader::ELEMENT ) {
346
  continue;
347
  }
348
 
502
  */
503
  protected function import_start( $file ) {
504
  if ( ! is_file( $file ) ) {
505
+ return new \WP_Error( 'wxr_importer.file_missing', __( 'The file does not exist, please try again.', 'wordpress-importer' ) );
506
  }
507
 
508
  // Suspend bunches of stuff in WP core
661
 
662
  if ( $data['post_status'] === 'auto-draft' ) {
663
  // Bail now
664
+ return new \WP_Error(
665
  'wxr_importer.post.cannot_import_draft',
666
  __( 'Cannot import auto-draft posts' ),
667
  $data
1034
 
1035
  $info = wp_check_filetype( $upload['file'] );
1036
  if ( ! $info ) {
1037
+ return new \WP_Error( 'attachment_processing_error', __( 'Invalid file type', 'wordpress-importer' ) );
1038
  }
1039
 
1040
  $post['post_mime_type'] = $info['type'];
1603
  $key = array_search( $child->tagName, $tag_name );
1604
  if ( $key ) {
1605
  $data[ $key ] = $child->textContent;
1606
+ } else if ( $child->tagName == 'wp:termmeta' ) {
1607
+ $meta_item = $this->parse_meta_node( $child );
1608
+ if ( ! empty( $meta_item ) ) {
1609
+ $meta[] = $meta_item;
1610
+ }
1611
  }
1612
  }
1613
 
1718
  $term_id
1719
  ) );
1720
 
1721
+ $this->process_term_meta( $meta, $term_id, $term );
1722
+
1723
  do_action( 'wp_import_insert_term', $term_id, $data );
1724
 
1725
  /**
1731
  do_action( 'wxr_importer.processed.term', $term_id, $data );
1732
  }
1733
 
1734
+ /**
1735
+ * Process and import term meta items.
1736
+ *
1737
+ * @param array $meta List of meta data arrays
1738
+ * @param int $term_id Term ID to associate with
1739
+ * @param array $term Term data
1740
+ * @return int|bool Number of meta items imported on success, false otherwise.
1741
+ */
1742
+ protected function process_term_meta( $meta, $term_id, $term ) {
1743
+ if ( empty( $meta ) ) {
1744
+ return true;
1745
+ }
1746
+
1747
+ foreach ( $meta as $meta_item ) {
1748
+ /**
1749
+ * Pre-process term meta data.
1750
+ *
1751
+ * @param array $meta_item Meta data. (Return empty to skip.)
1752
+ * @param int $term_id Term the meta is attached to.
1753
+ */
1754
+ $meta_item = apply_filters( 'wxr_importer.pre_process.term_meta', $meta_item, $term_id );
1755
+ if ( empty( $meta_item ) ) {
1756
+ return false;
1757
+ }
1758
+
1759
+ $key = apply_filters( 'import_term_meta_key', $meta_item['key'], $term_id, $term );
1760
+ $value = false;
1761
+
1762
+ if ( $key ) {
1763
+ // export gets meta straight from the DB so could have a serialized string
1764
+ if ( ! $value ) {
1765
+ $value = maybe_unserialize( $meta_item['value'] );
1766
+ }
1767
+
1768
+ add_term_meta( $term_id, $key, $value );
1769
+ do_action( 'import_term_meta', $term_id, $key, $value );
1770
+ }
1771
+ }
1772
+
1773
+ return true;
1774
+ }
1775
+
1776
  /**
1777
  * Attempt to download a remote file attachment
1778
  *
1787
  // get placeholder file in the upload dir with a unique, sanitized filename
1788
  $upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
1789
  if ( $upload['error'] ) {
1790
+ return new \WP_Error( 'upload_dir_error', $upload['error'] );
1791
  }
1792
 
1793
  // fetch the remote url and write it to the placeholder file
1807
  // make sure the fetch was successful
1808
  if ( $code !== 200 ) {
1809
  unlink( $upload['file'] );
1810
+ return new \WP_Error(
1811
  'import_file_error',
1812
  sprintf(
1813
  __( 'Remote server returned %1$d %2$s for %3$s', 'wordpress-importer' ),
1823
 
1824
  if ( isset( $headers['content-length'] ) && $filesize !== (int) $headers['content-length'] ) {
1825
  unlink( $upload['file'] );
1826
+ return new \WP_Error( 'import_file_error', __( 'Remote file is incorrect size', 'wordpress-importer' ) );
1827
  }
1828
 
1829
  if ( 0 === $filesize ) {
1830
  unlink( $upload['file'] );
1831
+ return new \WP_Error( 'import_file_error', __( 'Zero size file downloaded', 'wordpress-importer' ) );
1832
  }
1833
 
1834
  $max_size = (int) $this->max_attachment_size();
1835
  if ( ! empty( $max_size ) && $filesize > $max_size ) {
1836
  unlink( $upload['file'] );
1837
  $message = sprintf( __( 'Remote file is too large, limit is %s', 'wordpress-importer' ), size_format( $max_size ) );
1838
+ return new \WP_Error( 'import_file_error', $message );
1839
  }
1840
 
1841
  return $upload;