Version Description
Release Date - 21 July 2020
- Improved code execution: not loading plugin code on frontend.
- Fixed incorrect post and post meta import (unicode and other special characters were not escaped properly).
- Fixed error (500 - internal error) for Widgets import on PHP 7.x.
- Fixed PHP notices for manual demo import.
- Fixed PHP warning if
set_time_limitfunction is disabled. - Fixed links for switching manual and predefined import modes.
Download this release
Release Info
| Developer | capuderg |
| Plugin | |
| Version | 2.6.0 |
| Comparing to | |
| See all releases | |
Code changes from version 2.5.2 to 2.6.0
- inc/Helpers.php +22 -6
- inc/Importer.php +3 -1
- inc/Logger.php +1 -1
- inc/OneClickDemoImport.php +6 -1
- inc/WXRImporter.php +1 -1
- inc/WidgetImporter.php +7 -0
- languages/pt-ocdi.pot +71 -66
- one-click-demo-import.php +1 -1
- readme.txt +21 -11
- vendor/autoload.php +1 -1
- vendor/awesomemotive/wp-content-importer-v2/README.md +35 -0
- vendor/awesomemotive/wp-content-importer-v2/composer.json +25 -0
- vendor/awesomemotive/wp-content-importer-v2/src/Importer.php +629 -0
- vendor/{proteusthemes → awesomemotive}/wp-content-importer-v2/src/WPImporterLogger.php +1 -1
- vendor/{proteusthemes → awesomemotive}/wp-content-importer-v2/src/WPImporterLoggerCLI.php +1 -1
- vendor/{proteusthemes → awesomemotive}/wp-content-importer-v2/src/WXRImportInfo.php +2 -2
- vendor/{proteusthemes → awesomemotive}/wp-content-importer-v2/src/WXRImporter.php +93 -39
- vendor/composer/autoload_psr4.php +1 -1
- vendor/composer/autoload_real.php +7 -4
- vendor/composer/autoload_static.php +11 -11
- vendor/composer/installed.json +22 -14
- vendor/proteusthemes/wp-content-importer-v2/README.md +0 -25
- vendor/proteusthemes/wp-content-importer-v2/composer.json +0 -17
- views/plugin-page.php +2 -2
inc/Helpers.php
CHANGED
|
@@ -433,11 +433,27 @@ class Helpers {
|
|
| 433 |
'test_type' => false,
|
| 434 |
);
|
| 435 |
|
| 436 |
-
//
|
| 437 |
-
$
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
|
| 442 |
// Process content import file.
|
| 443 |
if ( $content_file_info && ! isset( $content_file_info['error'] ) ) {
|
|
@@ -449,7 +465,7 @@ class Helpers {
|
|
| 449 |
$log_added = self::append_to_file(
|
| 450 |
sprintf(
|
| 451 |
__( 'Content file was not uploaded. Error: %s', 'pt-ocdi' ),
|
| 452 |
-
$
|
| 453 |
),
|
| 454 |
$log_file_path,
|
| 455 |
esc_html__( 'Upload files' , 'pt-ocdi' )
|
| 433 |
'test_type' => false,
|
| 434 |
);
|
| 435 |
|
| 436 |
+
// Error data if the demo file was not provided.
|
| 437 |
+
$file_not_provided_error = array(
|
| 438 |
+
'error' => esc_html__( 'No file provided.', 'pt-ocdi' )
|
| 439 |
+
);
|
| 440 |
+
|
| 441 |
+
// Handle demo file uploads.
|
| 442 |
+
$content_file_info = isset( $_FILES['content_file'] ) ?
|
| 443 |
+
wp_handle_upload( $_FILES['content_file'], $upload_overrides ) :
|
| 444 |
+
$file_not_provided_error;
|
| 445 |
+
|
| 446 |
+
$widget_file_info = isset( $_FILES['widget_file'] ) ?
|
| 447 |
+
wp_handle_upload( $_FILES['widget_file'], $upload_overrides ) :
|
| 448 |
+
$file_not_provided_error;
|
| 449 |
+
|
| 450 |
+
$customizer_file_info = isset( $_FILES['customizer_file'] ) ?
|
| 451 |
+
wp_handle_upload( $_FILES['customizer_file'], $upload_overrides ) :
|
| 452 |
+
$file_not_provided_error;
|
| 453 |
+
|
| 454 |
+
$redux_file_info = isset( $_FILES['customizer_file'] ) ?
|
| 455 |
+
wp_handle_upload( $_FILES['redux_file'], $upload_overrides ) :
|
| 456 |
+
$file_not_provided_error;
|
| 457 |
|
| 458 |
// Process content import file.
|
| 459 |
if ( $content_file_info && ! isset( $content_file_info['error'] ) ) {
|
| 465 |
$log_added = self::append_to_file(
|
| 466 |
sprintf(
|
| 467 |
__( 'Content file was not uploaded. Error: %s', 'pt-ocdi' ),
|
| 468 |
+
$content_file_info['error']
|
| 469 |
),
|
| 470 |
$log_file_path,
|
| 471 |
esc_html__( 'Upload files' , 'pt-ocdi' )
|
inc/Importer.php
CHANGED
|
@@ -118,7 +118,9 @@ class Importer {
|
|
| 118 |
$this->microtime = microtime( true );
|
| 119 |
|
| 120 |
// Increase PHP max execution time. Just in case, even though the AJAX calls are only 25 sec long.
|
| 121 |
-
|
|
|
|
|
|
|
| 122 |
|
| 123 |
// Disable import of authors.
|
| 124 |
add_filter( 'wxr_importer.pre_process.user', '__return_false' );
|
| 118 |
$this->microtime = microtime( true );
|
| 119 |
|
| 120 |
// Increase PHP max execution time. Just in case, even though the AJAX calls are only 25 sec long.
|
| 121 |
+
if ( strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) === false ) {
|
| 122 |
+
set_time_limit( apply_filters( 'pt-ocdi/set_time_limit_for_demo_data_import', 300 ) );
|
| 123 |
+
}
|
| 124 |
|
| 125 |
// Disable import of authors.
|
| 126 |
add_filter( 'wxr_importer.pre_process.user', '__return_false' );
|
inc/Logger.php
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 7 |
|
| 8 |
namespace OCDI;
|
| 9 |
|
| 10 |
-
class Logger extends \
|
| 11 |
/**
|
| 12 |
* Variable for front-end error display.
|
| 13 |
*
|
| 7 |
|
| 8 |
namespace OCDI;
|
| 9 |
|
| 10 |
+
class Logger extends \AwesomeMotive\WPContentImporter2\WPImporterLoggerCLI {
|
| 11 |
/**
|
| 12 |
* Variable for front-end error display.
|
| 13 |
*
|
inc/OneClickDemoImport.php
CHANGED
|
@@ -152,7 +152,6 @@ class OneClickDemoImport {
|
|
| 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.
|
|
@@ -441,6 +440,7 @@ class OneClickDemoImport {
|
|
| 441 |
$this->log_file_path = empty( $data['log_file_path'] ) ? '' : $data['log_file_path'];
|
| 442 |
$this->selected_index = empty( $data['selected_index'] ) ? 0 : $data['selected_index'];
|
| 443 |
$this->selected_import_files = empty( $data['selected_import_files'] ) ? array() : $data['selected_import_files'];
|
|
|
|
| 444 |
$this->before_import_executed = empty( $data['before_import_executed'] ) ? false : $data['before_import_executed'];
|
| 445 |
$this->importer->set_importer_data( $data );
|
| 446 |
|
|
@@ -461,6 +461,7 @@ class OneClickDemoImport {
|
|
| 461 |
'log_file_path' => $this->log_file_path,
|
| 462 |
'selected_index' => $this->selected_index,
|
| 463 |
'selected_import_files' => $this->selected_import_files,
|
|
|
|
| 464 |
'before_import_executed' => $this->before_import_executed,
|
| 465 |
);
|
| 466 |
}
|
|
@@ -528,6 +529,10 @@ class OneClickDemoImport {
|
|
| 528 |
* Get data from filters, after the theme has loaded and instantiate the importer.
|
| 529 |
*/
|
| 530 |
public function setup_plugin_with_filter_data() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
// Get info of import data files and filter it.
|
| 532 |
$this->import_files = Helpers::validate_import_file_info( apply_filters( 'pt-ocdi/import_files', array() ) );
|
| 533 |
|
| 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 |
* Plugin page display.
|
| 157 |
* Output (HTML) is in another file.
|
| 440 |
$this->log_file_path = empty( $data['log_file_path'] ) ? '' : $data['log_file_path'];
|
| 441 |
$this->selected_index = empty( $data['selected_index'] ) ? 0 : $data['selected_index'];
|
| 442 |
$this->selected_import_files = empty( $data['selected_import_files'] ) ? array() : $data['selected_import_files'];
|
| 443 |
+
$this->import_files = empty( $data['import_files'] ) ? array() : $data['import_files'];
|
| 444 |
$this->before_import_executed = empty( $data['before_import_executed'] ) ? false : $data['before_import_executed'];
|
| 445 |
$this->importer->set_importer_data( $data );
|
| 446 |
|
| 461 |
'log_file_path' => $this->log_file_path,
|
| 462 |
'selected_index' => $this->selected_index,
|
| 463 |
'selected_import_files' => $this->selected_import_files,
|
| 464 |
+
'import_files' => $this->import_files,
|
| 465 |
'before_import_executed' => $this->before_import_executed,
|
| 466 |
);
|
| 467 |
}
|
| 529 |
* Get data from filters, after the theme has loaded and instantiate the importer.
|
| 530 |
*/
|
| 531 |
public function setup_plugin_with_filter_data() {
|
| 532 |
+
if ( ! ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) ) {
|
| 533 |
+
return;
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
// Get info of import data files and filter it.
|
| 537 |
$this->import_files = Helpers::validate_import_file_info( apply_filters( 'pt-ocdi/import_files', array() ) );
|
| 538 |
|
inc/WXRImporter.php
CHANGED
|
@@ -9,7 +9,7 @@
|
|
| 9 |
|
| 10 |
namespace OCDI;
|
| 11 |
|
| 12 |
-
class WXRImporter extends \
|
| 13 |
/**
|
| 14 |
* Constructor method.
|
| 15 |
*
|
| 9 |
|
| 10 |
namespace OCDI;
|
| 11 |
|
| 12 |
+
class WXRImporter extends \AwesomeMotive\WPContentImporter2\WXRImporter {
|
| 13 |
/**
|
| 14 |
* Constructor method.
|
| 15 |
*
|
inc/WidgetImporter.php
CHANGED
|
@@ -246,6 +246,13 @@ class WidgetImporter {
|
|
| 246 |
|
| 247 |
// Assign widget instance to sidebar.
|
| 248 |
$sidebars_widgets = get_option( 'sidebars_widgets' ); // Which sidebars have which widgets, get fresh every time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
$new_instance_id = $id_base . '-' . $new_instance_id_number; // Use ID number from new widget instance.
|
| 250 |
$sidebars_widgets[ $use_sidebar_id ][] = $new_instance_id; // Add new instance to sidebar.
|
| 251 |
update_option( 'sidebars_widgets', $sidebars_widgets ); // Save the amended data.
|
| 246 |
|
| 247 |
// Assign widget instance to sidebar.
|
| 248 |
$sidebars_widgets = get_option( 'sidebars_widgets' ); // Which sidebars have which widgets, get fresh every time.
|
| 249 |
+
|
| 250 |
+
// Avoid rarely fatal error when the option is an empty string
|
| 251 |
+
// https://github.com/churchthemes/widget-importer-exporter/pull/11.
|
| 252 |
+
if ( ! $sidebars_widgets ) {
|
| 253 |
+
$sidebars_widgets = array();
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
$new_instance_id = $id_base . '-' . $new_instance_id_number; // Use ID number from new widget instance.
|
| 257 |
$sidebars_widgets[ $use_sidebar_id ][] = $new_instance_id; // Add new instance to sidebar.
|
| 258 |
update_option( 'sidebars_widgets', $sidebars_widgets ); // Save the amended data.
|
languages/pt-ocdi.pot
CHANGED
|
@@ -1,14 +1,15 @@
|
|
| 1 |
-
# Copyright (C)
|
| 2 |
# This file is distributed under the GPL 2.0.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: One Click Demo Import 2.
|
| 6 |
-
"Report-Msgid-Bugs-To:
|
|
|
|
| 7 |
"POT-Creation-Date: 2016-05-14 09:53:17+00:00\n"
|
| 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:
|
| 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"
|
|
@@ -58,19 +59,19 @@ msgid ""
|
|
| 58 |
"%6$s."
|
| 59 |
msgstr ""
|
| 60 |
|
| 61 |
-
#: inc/Helpers.php:
|
| 62 |
msgid ""
|
| 63 |
"An error occurred while writing file to your server! Tried to write a file "
|
| 64 |
"to: %s%s."
|
| 65 |
msgstr ""
|
| 66 |
|
| 67 |
-
#: inc/Helpers.php:
|
| 68 |
msgid ""
|
| 69 |
"An error occurred while reading a file from your server! Tried reading file "
|
| 70 |
"from path: %s%s."
|
| 71 |
msgstr ""
|
| 72 |
|
| 73 |
-
#: inc/Helpers.php:
|
| 74 |
msgid ""
|
| 75 |
"This WordPress page does not have %sdirect%s write file access. This plugin "
|
| 76 |
"needs it in order to save the demo import xml file to the upload directory "
|
|
@@ -81,128 +82,132 @@ msgstr ""
|
|
| 81 |
msgid "One Click Demo Import"
|
| 82 |
msgstr ""
|
| 83 |
|
| 84 |
-
#: inc/Helpers.php:
|
| 85 |
-
#: views/plugin-page.php:
|
| 86 |
msgid "Import Demo Data"
|
| 87 |
msgstr ""
|
| 88 |
|
| 89 |
-
#: inc/Helpers.php:
|
| 90 |
msgid ""
|
| 91 |
"An error occurred while retrieving reading/writing permissions to your "
|
| 92 |
"server (could not retrieve WP filesystem credentials)!"
|
| 93 |
msgstr ""
|
| 94 |
|
| 95 |
-
#: inc/Helpers.php:
|
| 96 |
msgid "Your WordPress login credentials don't allow to use WP_Filesystem!"
|
| 97 |
msgstr ""
|
| 98 |
|
| 99 |
-
#: inc/Helpers.php:
|
| 100 |
msgid "One Click Demo Import - "
|
| 101 |
msgstr ""
|
| 102 |
|
| 103 |
-
#: inc/Helpers.php:
|
| 104 |
msgid ""
|
| 105 |
"%sYour user role isn't high enough. You don't have permission to import "
|
| 106 |
"demo data.%s"
|
| 107 |
msgstr ""
|
| 108 |
|
| 109 |
-
#: inc/Helpers.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
msgid "Content file was not uploaded. Error: %s"
|
| 111 |
msgstr ""
|
| 112 |
|
| 113 |
-
#: inc/Helpers.php:
|
| 114 |
-
#: inc/Helpers.php:
|
| 115 |
msgid "Upload files"
|
| 116 |
msgstr ""
|
| 117 |
|
| 118 |
-
#: inc/Helpers.php:
|
| 119 |
msgid "Widget file was not uploaded. Error: %s"
|
| 120 |
msgstr ""
|
| 121 |
|
| 122 |
-
#: inc/Helpers.php:
|
| 123 |
msgid "Customizer file was not uploaded. Error: %s"
|
| 124 |
msgstr ""
|
| 125 |
|
| 126 |
-
#: inc/Helpers.php:
|
| 127 |
msgid "Missing Redux option name! Please also enter the Redux option name!"
|
| 128 |
msgstr ""
|
| 129 |
|
| 130 |
-
#: inc/Helpers.php:
|
| 131 |
msgid "Redux file was not uploaded. Error: %s"
|
| 132 |
msgstr ""
|
| 133 |
|
| 134 |
-
#: inc/Helpers.php:
|
| 135 |
msgid "The import files were successfully uploaded!"
|
| 136 |
msgstr ""
|
| 137 |
|
| 138 |
-
#: inc/Helpers.php:
|
| 139 |
msgid "Initial max execution time = %s"
|
| 140 |
msgstr ""
|
| 141 |
|
| 142 |
-
#: inc/Helpers.php:
|
| 143 |
msgid ""
|
| 144 |
"Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = "
|
| 145 |
"%4$s%1$sCustomizer file = %5$s%1$sRedux files:%1$s%6$s"
|
| 146 |
msgstr ""
|
| 147 |
|
| 148 |
-
#: inc/Helpers.php:
|
| 149 |
-
#: inc/Helpers.php:
|
| 150 |
msgid "not defined!"
|
| 151 |
msgstr ""
|
| 152 |
|
| 153 |
-
#: inc/Importer.php:
|
| 154 |
msgid "New AJAX call!"
|
| 155 |
msgstr ""
|
| 156 |
|
| 157 |
-
#: inc/OneClickDemoImport.php:
|
| 158 |
msgid "No preview image defined for this import."
|
| 159 |
msgstr ""
|
| 160 |
|
| 161 |
-
#: inc/OneClickDemoImport.php:
|
| 162 |
msgid "Are you sure?"
|
| 163 |
msgstr ""
|
| 164 |
|
| 165 |
-
#: inc/OneClickDemoImport.php:
|
| 166 |
msgid "Cancel"
|
| 167 |
msgstr ""
|
| 168 |
|
| 169 |
-
#: inc/OneClickDemoImport.php:
|
| 170 |
msgid "Yes, import!"
|
| 171 |
msgstr ""
|
| 172 |
|
| 173 |
-
#: inc/OneClickDemoImport.php:
|
| 174 |
msgid "Selected demo import:"
|
| 175 |
msgstr ""
|
| 176 |
|
| 177 |
-
#: inc/OneClickDemoImport.php:
|
| 178 |
msgid "Manually uploaded files"
|
| 179 |
msgstr ""
|
| 180 |
|
| 181 |
-
#: inc/OneClickDemoImport.php:
|
| 182 |
msgid "Downloaded files"
|
| 183 |
msgstr ""
|
| 184 |
|
| 185 |
-
#: inc/OneClickDemoImport.php:
|
| 186 |
msgid "The import files for: %s were successfully downloaded!"
|
| 187 |
msgstr ""
|
| 188 |
|
| 189 |
-
#: inc/OneClickDemoImport.php:
|
| 190 |
msgid "No import files specified!"
|
| 191 |
msgstr ""
|
| 192 |
|
| 193 |
-
#: inc/OneClickDemoImport.php:
|
| 194 |
msgid ""
|
| 195 |
"Just used One Click Demo Import plugin and it was awesome! Thanks "
|
| 196 |
"@ProteusThemes! #OCDI https://www.proteusthemes.com/"
|
| 197 |
msgstr ""
|
| 198 |
|
| 199 |
-
#: inc/OneClickDemoImport.php:
|
| 200 |
msgid ""
|
| 201 |
"%1$s%6$sWasn't this a great One Click Demo Import experience?%7$s Created "
|
| 202 |
"and maintained by %3$sProteusThemes%4$s. %2$s%5$sClick to Tweet!%4$s%8$s"
|
| 203 |
msgstr ""
|
| 204 |
|
| 205 |
-
#: inc/OneClickDemoImport.php:
|
| 206 |
msgid ""
|
| 207 |
"%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
|
| 208 |
"check your page and make sure that everything has imported correctly. If it "
|
|
@@ -210,7 +215,7 @@ msgid ""
|
|
| 210 |
"it has done its job.%5$s"
|
| 211 |
msgstr ""
|
| 212 |
|
| 213 |
-
#: inc/OneClickDemoImport.php:
|
| 214 |
msgid ""
|
| 215 |
"%1$sThe demo import has finished, but there were some import "
|
| 216 |
"errors.%2$sMore details about the errors can be found in this %3$s%5$slog "
|
|
@@ -367,19 +372,19 @@ msgstr ""
|
|
| 367 |
msgid "Widget already exists"
|
| 368 |
msgstr ""
|
| 369 |
|
| 370 |
-
#: inc/WidgetImporter.php:
|
| 371 |
msgid "Imported"
|
| 372 |
msgstr ""
|
| 373 |
|
| 374 |
-
#: inc/WidgetImporter.php:
|
| 375 |
msgid "Imported to Inactive"
|
| 376 |
msgstr ""
|
| 377 |
|
| 378 |
-
#: inc/WidgetImporter.php:
|
| 379 |
msgid "No Title"
|
| 380 |
msgstr ""
|
| 381 |
|
| 382 |
-
#: inc/WidgetImporter.php:
|
| 383 |
msgid "No results for widget import!"
|
| 384 |
msgstr ""
|
| 385 |
|
|
@@ -391,109 +396,109 @@ msgid ""
|
|
| 391 |
"PHP: %2$s%1$s%3$s"
|
| 392 |
msgstr ""
|
| 393 |
|
| 394 |
-
#: views/plugin-page.php:
|
| 395 |
msgid ""
|
| 396 |
"%sWarning: your server is using %sPHP safe mode%s. This means that you "
|
| 397 |
"might experience server timeout errors.%s"
|
| 398 |
msgstr ""
|
| 399 |
|
| 400 |
-
#: views/plugin-page.php:
|
| 401 |
msgid "Before you begin, make sure all the required plugins are activated."
|
| 402 |
msgstr ""
|
| 403 |
|
| 404 |
-
#: views/plugin-page.php:
|
| 405 |
msgid ""
|
| 406 |
"Importing demo data (post, pages, images, theme settings, ...) is the "
|
| 407 |
"easiest way to setup your theme."
|
| 408 |
msgstr ""
|
| 409 |
|
| 410 |
-
#: views/plugin-page.php:
|
| 411 |
msgid ""
|
| 412 |
"It will allow you to quickly edit everything instead of creating content "
|
| 413 |
"from scratch."
|
| 414 |
msgstr ""
|
| 415 |
|
| 416 |
-
#: views/plugin-page.php:
|
| 417 |
msgid "When you import the data, the following things might happen:"
|
| 418 |
msgstr ""
|
| 419 |
|
| 420 |
-
#: views/plugin-page.php:
|
| 421 |
msgid ""
|
| 422 |
"No existing posts, pages, categories, images, custom post types or any "
|
| 423 |
"other data will be deleted or modified."
|
| 424 |
msgstr ""
|
| 425 |
|
| 426 |
-
#: views/plugin-page.php:
|
| 427 |
msgid ""
|
| 428 |
"Posts, pages, images, widgets, menus and other theme settings will get "
|
| 429 |
"imported."
|
| 430 |
msgstr ""
|
| 431 |
|
| 432 |
-
#: views/plugin-page.php:
|
| 433 |
msgid ""
|
| 434 |
"Please click on the Import button only once and wait, it can take a couple "
|
| 435 |
"of minutes."
|
| 436 |
msgstr ""
|
| 437 |
|
| 438 |
-
#: views/plugin-page.php:
|
| 439 |
msgid "Switch to manual import!"
|
| 440 |
msgstr ""
|
| 441 |
|
| 442 |
-
#: views/plugin-page.php:
|
| 443 |
msgid "Switch back to theme predefined imports!"
|
| 444 |
msgstr ""
|
| 445 |
|
| 446 |
-
#: views/plugin-page.php:
|
| 447 |
msgid ""
|
| 448 |
"There are no predefined import files available in this theme. Please upload "
|
| 449 |
"the import files manually!"
|
| 450 |
msgstr ""
|
| 451 |
|
| 452 |
-
#: views/plugin-page.php:
|
| 453 |
msgid "Manual demo files upload"
|
| 454 |
msgstr ""
|
| 455 |
|
| 456 |
-
#: views/plugin-page.php:
|
| 457 |
msgid "Choose a XML file for content import:"
|
| 458 |
msgstr ""
|
| 459 |
|
| 460 |
-
#: views/plugin-page.php:
|
| 461 |
msgid "Choose a WIE or JSON file for widget import:"
|
| 462 |
msgstr ""
|
| 463 |
|
| 464 |
-
#: views/plugin-page.php:
|
| 465 |
msgid "Choose a DAT file for customizer import:"
|
| 466 |
msgstr ""
|
| 467 |
|
| 468 |
-
#: views/plugin-page.php:
|
| 469 |
msgid "Choose a JSON file for Redux import:"
|
| 470 |
msgstr ""
|
| 471 |
|
| 472 |
-
#: views/plugin-page.php:
|
| 473 |
msgid "Enter the Redux option name:"
|
| 474 |
msgstr ""
|
| 475 |
|
| 476 |
-
#: views/plugin-page.php:
|
| 477 |
msgid "All"
|
| 478 |
msgstr ""
|
| 479 |
|
| 480 |
-
#: views/plugin-page.php:
|
| 481 |
msgid "Search demos..."
|
| 482 |
msgstr ""
|
| 483 |
|
| 484 |
-
#: views/plugin-page.php:
|
| 485 |
msgid "No preview image."
|
| 486 |
msgstr ""
|
| 487 |
|
| 488 |
-
#: views/plugin-page.php:
|
| 489 |
msgid "Import"
|
| 490 |
msgstr ""
|
| 491 |
|
| 492 |
-
#: views/plugin-page.php:
|
| 493 |
msgid "Preview"
|
| 494 |
msgstr ""
|
| 495 |
|
| 496 |
-
#: views/plugin-page.php:
|
| 497 |
msgid "Importing, please wait!"
|
| 498 |
msgstr ""
|
| 499 |
|
| 1 |
+
# Copyright (C) 2020 Awesome Motive
|
| 2 |
# This file is distributed under the GPL 2.0.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: One Click Demo Import 2.6.0\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: "
|
| 7 |
+
"https://wordpress.org/support/plugin/one-click-demo-import/\n"
|
| 8 |
"POT-Creation-Date: 2016-05-14 09:53:17+00:00\n"
|
| 9 |
"MIME-Version: 1.0\n"
|
| 10 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 11 |
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
+
"PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
|
| 13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 15 |
"X-Generator: grunt-wp-i18n 0.5.4\n"
|
| 59 |
"%6$s."
|
| 60 |
msgstr ""
|
| 61 |
|
| 62 |
+
#: inc/Helpers.php:199 inc/Helpers.php:242
|
| 63 |
msgid ""
|
| 64 |
"An error occurred while writing file to your server! Tried to write a file "
|
| 65 |
"to: %s%s."
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
+
#: inc/Helpers.php:276
|
| 69 |
msgid ""
|
| 70 |
"An error occurred while reading a file from your server! Tried reading file "
|
| 71 |
"from path: %s%s."
|
| 72 |
msgstr ""
|
| 73 |
|
| 74 |
+
#: inc/Helpers.php:299
|
| 75 |
msgid ""
|
| 76 |
"This WordPress page does not have %sdirect%s write file access. This plugin "
|
| 77 |
"needs it in order to save the demo import xml file to the upload directory "
|
| 82 |
msgid "One Click Demo Import"
|
| 83 |
msgstr ""
|
| 84 |
|
| 85 |
+
#: inc/Helpers.php:311 inc/OneClickDemoImport.php:138 views/plugin-page.php:124
|
| 86 |
+
#: views/plugin-page.php:136
|
| 87 |
msgid "Import Demo Data"
|
| 88 |
msgstr ""
|
| 89 |
|
| 90 |
+
#: inc/Helpers.php:323
|
| 91 |
msgid ""
|
| 92 |
"An error occurred while retrieving reading/writing permissions to your "
|
| 93 |
"server (could not retrieve WP filesystem credentials)!"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
+
#: inc/Helpers.php:331
|
| 97 |
msgid "Your WordPress login credentials don't allow to use WP_Filesystem!"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
+
#: inc/Helpers.php:371
|
| 101 |
msgid "One Click Demo Import - "
|
| 102 |
msgstr ""
|
| 103 |
|
| 104 |
+
#: inc/Helpers.php:405
|
| 105 |
msgid ""
|
| 106 |
"%sYour user role isn't high enough. You don't have permission to import "
|
| 107 |
"demo data.%s"
|
| 108 |
msgstr ""
|
| 109 |
|
| 110 |
+
#: inc/Helpers.php:438
|
| 111 |
+
msgid "No file provided."
|
| 112 |
+
msgstr ""
|
| 113 |
+
|
| 114 |
+
#: inc/Helpers.php:467
|
| 115 |
msgid "Content file was not uploaded. Error: %s"
|
| 116 |
msgstr ""
|
| 117 |
|
| 118 |
+
#: inc/Helpers.php:471 inc/Helpers.php:488 inc/Helpers.php:505
|
| 119 |
+
#: inc/Helpers.php:516 inc/Helpers.php:536 inc/Helpers.php:544
|
| 120 |
msgid "Upload files"
|
| 121 |
msgstr ""
|
| 122 |
|
| 123 |
+
#: inc/Helpers.php:484
|
| 124 |
msgid "Widget file was not uploaded. Error: %s"
|
| 125 |
msgstr ""
|
| 126 |
|
| 127 |
+
#: inc/Helpers.php:501
|
| 128 |
msgid "Customizer file was not uploaded. Error: %s"
|
| 129 |
msgstr ""
|
| 130 |
|
| 131 |
+
#: inc/Helpers.php:514
|
| 132 |
msgid "Missing Redux option name! Please also enter the Redux option name!"
|
| 133 |
msgstr ""
|
| 134 |
|
| 135 |
+
#: inc/Helpers.php:532
|
| 136 |
msgid "Redux file was not uploaded. Error: %s"
|
| 137 |
msgstr ""
|
| 138 |
|
| 139 |
+
#: inc/Helpers.php:542
|
| 140 |
msgid "The import files were successfully uploaded!"
|
| 141 |
msgstr ""
|
| 142 |
|
| 143 |
+
#: inc/Helpers.php:568
|
| 144 |
msgid "Initial max execution time = %s"
|
| 145 |
msgstr ""
|
| 146 |
|
| 147 |
+
#: inc/Helpers.php:572
|
| 148 |
msgid ""
|
| 149 |
"Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = "
|
| 150 |
"%4$s%1$sCustomizer file = %5$s%1$sRedux files:%1$s%6$s"
|
| 151 |
msgstr ""
|
| 152 |
|
| 153 |
+
#: inc/Helpers.php:575 inc/Helpers.php:576 inc/Helpers.php:577
|
| 154 |
+
#: inc/Helpers.php:578
|
| 155 |
msgid "not defined!"
|
| 156 |
msgstr ""
|
| 157 |
|
| 158 |
+
#: inc/Importer.php:174
|
| 159 |
msgid "New AJAX call!"
|
| 160 |
msgstr ""
|
| 161 |
|
| 162 |
+
#: inc/OneClickDemoImport.php:189
|
| 163 |
msgid "No preview image defined for this import."
|
| 164 |
msgstr ""
|
| 165 |
|
| 166 |
+
#: inc/OneClickDemoImport.php:190
|
| 167 |
msgid "Are you sure?"
|
| 168 |
msgstr ""
|
| 169 |
|
| 170 |
+
#: inc/OneClickDemoImport.php:191
|
| 171 |
msgid "Cancel"
|
| 172 |
msgstr ""
|
| 173 |
|
| 174 |
+
#: inc/OneClickDemoImport.php:192
|
| 175 |
msgid "Yes, import!"
|
| 176 |
msgstr ""
|
| 177 |
|
| 178 |
+
#: inc/OneClickDemoImport.php:193
|
| 179 |
msgid "Selected demo import:"
|
| 180 |
msgstr ""
|
| 181 |
|
| 182 |
+
#: inc/OneClickDemoImport.php:240
|
| 183 |
msgid "Manually uploaded files"
|
| 184 |
msgstr ""
|
| 185 |
|
| 186 |
+
#: inc/OneClickDemoImport.php:253 inc/OneClickDemoImport.php:264
|
| 187 |
msgid "Downloaded files"
|
| 188 |
msgstr ""
|
| 189 |
|
| 190 |
+
#: inc/OneClickDemoImport.php:260
|
| 191 |
msgid "The import files for: %s were successfully downloaded!"
|
| 192 |
msgstr ""
|
| 193 |
|
| 194 |
+
#: inc/OneClickDemoImport.php:269
|
| 195 |
msgid "No import files specified!"
|
| 196 |
msgstr ""
|
| 197 |
|
| 198 |
+
#: inc/OneClickDemoImport.php:390
|
| 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:393
|
| 205 |
msgid ""
|
| 206 |
"%1$s%6$sWasn't this a great One Click Demo Import experience?%7$s Created "
|
| 207 |
"and maintained by %3$sProteusThemes%4$s. %2$s%5$sClick to Tweet!%4$s%8$s"
|
| 208 |
msgstr ""
|
| 209 |
|
| 210 |
+
#: inc/OneClickDemoImport.php:406
|
| 211 |
msgid ""
|
| 212 |
"%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
|
| 213 |
"check your page and make sure that everything has imported correctly. If it "
|
| 215 |
"it has done its job.%5$s"
|
| 216 |
msgstr ""
|
| 217 |
|
| 218 |
+
#: inc/OneClickDemoImport.php:417
|
| 219 |
msgid ""
|
| 220 |
"%1$sThe demo import has finished, but there were some import "
|
| 221 |
"errors.%2$sMore details about the errors can be found in this %3$s%5$slog "
|
| 372 |
msgid "Widget already exists"
|
| 373 |
msgstr ""
|
| 374 |
|
| 375 |
+
#: inc/WidgetImporter.php:276
|
| 376 |
msgid "Imported"
|
| 377 |
msgstr ""
|
| 378 |
|
| 379 |
+
#: inc/WidgetImporter.php:280
|
| 380 |
msgid "Imported to Inactive"
|
| 381 |
msgstr ""
|
| 382 |
|
| 383 |
+
#: inc/WidgetImporter.php:286
|
| 384 |
msgid "No Title"
|
| 385 |
msgstr ""
|
| 386 |
|
| 387 |
+
#: inc/WidgetImporter.php:333
|
| 388 |
msgid "No results for widget import!"
|
| 389 |
msgstr ""
|
| 390 |
|
| 396 |
"PHP: %2$s%1$s%3$s"
|
| 397 |
msgstr ""
|
| 398 |
|
| 399 |
+
#: views/plugin-page.php:35
|
| 400 |
msgid ""
|
| 401 |
"%sWarning: your server is using %sPHP safe mode%s. This means that you "
|
| 402 |
"might experience server timeout errors.%s"
|
| 403 |
msgstr ""
|
| 404 |
|
| 405 |
+
#: views/plugin-page.php:48
|
| 406 |
msgid "Before you begin, make sure all the required plugins are activated."
|
| 407 |
msgstr ""
|
| 408 |
|
| 409 |
+
#: views/plugin-page.php:53
|
| 410 |
msgid ""
|
| 411 |
"Importing demo data (post, pages, images, theme settings, ...) is the "
|
| 412 |
"easiest way to setup your theme."
|
| 413 |
msgstr ""
|
| 414 |
|
| 415 |
+
#: views/plugin-page.php:54
|
| 416 |
msgid ""
|
| 417 |
"It will allow you to quickly edit everything instead of creating content "
|
| 418 |
"from scratch."
|
| 419 |
msgstr ""
|
| 420 |
|
| 421 |
+
#: views/plugin-page.php:59
|
| 422 |
msgid "When you import the data, the following things might happen:"
|
| 423 |
msgstr ""
|
| 424 |
|
| 425 |
+
#: views/plugin-page.php:62
|
| 426 |
msgid ""
|
| 427 |
"No existing posts, pages, categories, images, custom post types or any "
|
| 428 |
"other data will be deleted or modified."
|
| 429 |
msgstr ""
|
| 430 |
|
| 431 |
+
#: views/plugin-page.php:63
|
| 432 |
msgid ""
|
| 433 |
"Posts, pages, images, widgets, menus and other theme settings will get "
|
| 434 |
"imported."
|
| 435 |
msgstr ""
|
| 436 |
|
| 437 |
+
#: views/plugin-page.php:64
|
| 438 |
msgid ""
|
| 439 |
"Please click on the Import button only once and wait, it can take a couple "
|
| 440 |
"of minutes."
|
| 441 |
msgstr ""
|
| 442 |
|
| 443 |
+
#: views/plugin-page.php:69
|
| 444 |
msgid "Switch to manual import!"
|
| 445 |
msgstr ""
|
| 446 |
|
| 447 |
+
#: views/plugin-page.php:71
|
| 448 |
msgid "Switch back to theme predefined imports!"
|
| 449 |
msgstr ""
|
| 450 |
|
| 451 |
+
#: views/plugin-page.php:87
|
| 452 |
msgid ""
|
| 453 |
"There are no predefined import files available in this theme. Please upload "
|
| 454 |
"the import files manually!"
|
| 455 |
msgstr ""
|
| 456 |
|
| 457 |
+
#: views/plugin-page.php:94
|
| 458 |
msgid "Manual demo files upload"
|
| 459 |
msgstr ""
|
| 460 |
|
| 461 |
+
#: views/plugin-page.php:97
|
| 462 |
msgid "Choose a XML file for content import:"
|
| 463 |
msgstr ""
|
| 464 |
|
| 465 |
+
#: views/plugin-page.php:102
|
| 466 |
msgid "Choose a WIE or JSON file for widget import:"
|
| 467 |
msgstr ""
|
| 468 |
|
| 469 |
+
#: views/plugin-page.php:107
|
| 470 |
msgid "Choose a DAT file for customizer import:"
|
| 471 |
msgstr ""
|
| 472 |
|
| 473 |
+
#: views/plugin-page.php:113
|
| 474 |
msgid "Choose a JSON file for Redux import:"
|
| 475 |
msgstr ""
|
| 476 |
|
| 477 |
+
#: views/plugin-page.php:116
|
| 478 |
msgid "Enter the Redux option name:"
|
| 479 |
msgstr ""
|
| 480 |
|
| 481 |
+
#: views/plugin-page.php:151
|
| 482 |
msgid "All"
|
| 483 |
msgstr ""
|
| 484 |
|
| 485 |
+
#: views/plugin-page.php:158
|
| 486 |
msgid "Search demos..."
|
| 487 |
msgstr ""
|
| 488 |
|
| 489 |
+
#: views/plugin-page.php:179
|
| 490 |
msgid "No preview image."
|
| 491 |
msgstr ""
|
| 492 |
|
| 493 |
+
#: views/plugin-page.php:184
|
| 494 |
msgid "Import"
|
| 495 |
msgstr ""
|
| 496 |
|
| 497 |
+
#: views/plugin-page.php:186
|
| 498 |
msgid "Preview"
|
| 499 |
msgstr ""
|
| 500 |
|
| 501 |
+
#: views/plugin-page.php:199
|
| 502 |
msgid "Importing, please wait!"
|
| 503 |
msgstr ""
|
| 504 |
|
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.
|
| 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.6.0
|
| 8 |
Author: ProteusThemes
|
| 9 |
Author URI: http://www.proteusthemes.com
|
| 10 |
License: GPL3
|
readme.txt
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
=== One Click Demo Import ===
|
| 2 |
-
Contributors:
|
| 3 |
Tags: import, content, demo, data, widgets, settings, redux, theme options
|
| 4 |
-
Requires at least: 4.0
|
| 5 |
-
Tested up to: 5.
|
| 6 |
-
|
|
|
|
| 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.
|
|
@@ -16,15 +17,13 @@ The best feature of this plugin is, that theme authors can define import files i
|
|
| 16 |
>
|
| 17 |
> Setup One Click Demo Imports for your theme and your users will thank you for it!
|
| 18 |
>
|
| 19 |
-
> [Follow this easy guide on how to setup this plugin for your themes!](http://
|
| 20 |
-
>
|
| 21 |
-
> Also [sign up to the newsletter](http://proteusthemes.github.io/one-click-demo-import/#ocdi-newsletter-signup), so we can inform you about any updates, changes or improvements.
|
| 22 |
|
| 23 |
> **Are you a theme user?**
|
| 24 |
>
|
| 25 |
-
> Contact the author of your theme and [let them know about this plugin](http://
|
| 26 |
>
|
| 27 |
-
> "[Where can I find the contact of the theme author?](http://
|
| 28 |
|
| 29 |
This plugin will create a submenu page under Appearance with the title **Import demo data**.
|
| 30 |
|
|
@@ -38,7 +37,7 @@ NOTE: There is no setting to "connect" authors from the demo import file to the
|
|
| 38 |
|
| 39 |
**Do you want to contribute?**
|
| 40 |
|
| 41 |
-
Please refer to the official [GitHub repository](https://github.com/
|
| 42 |
|
| 43 |
== Installation ==
|
| 44 |
|
|
@@ -383,7 +382,7 @@ This happens, because your hosting server is using a very old version of PHP. Th
|
|
| 383 |
|
| 384 |
= Issues with the import, that we can't fix in the plugin =
|
| 385 |
|
| 386 |
-
Please visit this [docs page](https://github.com/
|
| 387 |
|
| 388 |
== Screenshots ==
|
| 389 |
|
|
@@ -393,6 +392,17 @@ Please visit this [docs page](https://github.com/proteusthemes/one-click-demo-im
|
|
| 393 |
|
| 394 |
== Changelog ==
|
| 395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
= 2.5.2 =
|
| 397 |
|
| 398 |
*Release Date - 29 July 2019*
|
| 1 |
=== One Click Demo Import ===
|
| 2 |
+
Contributors: smub, proteusthemes
|
| 3 |
Tags: import, content, demo, data, widgets, settings, redux, theme options
|
| 4 |
+
Requires at least: 4.0
|
| 5 |
+
Tested up to: 5.4
|
| 6 |
+
Requires PHP: 5.3.2
|
| 7 |
+
Stable tag: 2.6.0
|
| 8 |
License: GPLv3 or later
|
| 9 |
|
| 10 |
Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
|
| 17 |
>
|
| 18 |
> Setup One Click Demo Imports for your theme and your users will thank you for it!
|
| 19 |
>
|
| 20 |
+
> [Follow this easy guide on how to setup this plugin for your themes!](http://awesomemotive.github.io/one-click-demo-import/)
|
|
|
|
|
|
|
| 21 |
|
| 22 |
> **Are you a theme user?**
|
| 23 |
>
|
| 24 |
+
> Contact the author of your theme and [let them know about this plugin](http://awesomemotive.github.io/one-click-demo-import/theme-users.html). Theme authors can make any theme compatible with this plugin in 15 minutes and make it much more user-friendly.
|
| 25 |
>
|
| 26 |
+
> "[Where can I find the contact of the theme author?](http://awesomemotive.github.io/one-click-demo-import/theme-users.html)"
|
| 27 |
|
| 28 |
This plugin will create a submenu page under Appearance with the title **Import demo data**.
|
| 29 |
|
| 37 |
|
| 38 |
**Do you want to contribute?**
|
| 39 |
|
| 40 |
+
Please refer to the official [GitHub repository](https://github.com/awesomemotive/one-click-demo-import) of this plugin.
|
| 41 |
|
| 42 |
== Installation ==
|
| 43 |
|
| 382 |
|
| 383 |
= Issues with the import, that we can't fix in the plugin =
|
| 384 |
|
| 385 |
+
Please visit this [docs page](https://github.com/awesomemotive/one-click-demo-import/blob/master/docs/import-problems.md), for more answers to issues with importing data.
|
| 386 |
|
| 387 |
== Screenshots ==
|
| 388 |
|
| 392 |
|
| 393 |
== Changelog ==
|
| 394 |
|
| 395 |
+
= 2.6.0 =
|
| 396 |
+
|
| 397 |
+
*Release Date - 21 July 2020*
|
| 398 |
+
|
| 399 |
+
* Improved code execution: not loading plugin code on frontend.
|
| 400 |
+
* Fixed incorrect post and post meta import (unicode and other special characters were not escaped properly).
|
| 401 |
+
* Fixed error (500 - internal error) for Widgets import on PHP 7.x.
|
| 402 |
+
* Fixed PHP notices for manual demo import.
|
| 403 |
+
* Fixed PHP warning if `set_time_limit` function is disabled.
|
| 404 |
+
* Fixed links for switching manual and predefined import modes.
|
| 405 |
+
|
| 406 |
= 2.5.2 =
|
| 407 |
|
| 408 |
*Release Date - 29 July 2019*
|
vendor/autoload.php
CHANGED
|
@@ -4,4 +4,4 @@
|
|
| 4 |
|
| 5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
| 6 |
|
| 7 |
-
return
|
| 4 |
|
| 5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
| 6 |
|
| 7 |
+
return ComposerAutoloaderInitef3a658a88d521398d72929dc54fa111::getLoader();
|
vendor/awesomemotive/wp-content-importer-v2/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# WP content importer used in OCDI
|
| 2 |
+
|
| 3 |
+
List of files from the [original repo](https://github.com/humanmade/WordPress-Importer/):
|
| 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/awesomemotive/one-click-demo-import
|
| 13 |
+
|
| 14 |
+
## Changelog
|
| 15 |
+
|
| 16 |
+
*July 21st 2020*
|
| 17 |
+
- Fixed incorrect post meta import.
|
| 18 |
+
|
| 19 |
+
*July 14th 2020*
|
| 20 |
+
- Fixed incorrect post and post meta import (unicode and other special characters were not escaped properly).
|
| 21 |
+
|
| 22 |
+
*February 7th 2018*
|
| 23 |
+
- Clean up the WXRImporter code
|
| 24 |
+
- Created a "wrapper" class `Importer.php` with additional functionality (importing by smaller parts -> users, categories, tags, terms and posts)
|
| 25 |
+
- tagging version 2.0
|
| 26 |
+
|
| 27 |
+
*October 29th 2016*
|
| 28 |
+
|
| 29 |
+
- Cleaned up this forked repo, to only include the thing we need in the OCDI plugin.
|
| 30 |
+
- Changed the class names and use psr-4 autoloading in composer.json
|
| 31 |
+
|
| 32 |
+
*October 26th 2016*
|
| 33 |
+
|
| 34 |
+
- made a fork from the original repo
|
| 35 |
+
- merged a pull request for "term meta data" from the original repo: https://github.com/humanmade/WordPress-Importer/pull/18
|
vendor/awesomemotive/wp-content-importer-v2/composer.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "awesomemotive/wp-content-importer-v2",
|
| 3 |
+
"description": "Improved WP content importer used in OCDI plugin.",
|
| 4 |
+
"keywords": ["wp", "wordpress", "awesomemotive", "theme", "import", "content"],
|
| 5 |
+
"license": "GPL-2.0+",
|
| 6 |
+
"authors": [
|
| 7 |
+
{
|
| 8 |
+
"name": "Gregor Capuder",
|
| 9 |
+
"email": "capuderg@gmail.com"
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"name": "Primoz Cigler",
|
| 13 |
+
"email": "primoz@proteusnet.com"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"name" : "Humanmade contributors",
|
| 17 |
+
"homepage" : "https://github.com/humanmade/WordPress-Importer/graphs/contributors"
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"autoload": {
|
| 21 |
+
"psr-4": {
|
| 22 |
+
"AwesomeMotive\\WPContentImporter2\\": "src/"
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
}
|
vendor/awesomemotive/wp-content-importer-v2/src/Importer.php
ADDED
|
@@ -0,0 +1,629 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* The main importer class, extending the slightly modified WP importer 2.0 class WXRImporter
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
namespace AwesomeMotive\WPContentImporter2;
|
| 7 |
+
|
| 8 |
+
use XMLReader;
|
| 9 |
+
|
| 10 |
+
class Importer extends WXRImporter {
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Time in milliseconds, marking the beginning of the import.
|
| 14 |
+
*
|
| 15 |
+
* @var float
|
| 16 |
+
*/
|
| 17 |
+
private $start_time;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Importer constructor.
|
| 21 |
+
* Look at the parent constructor for the options parameters.
|
| 22 |
+
*
|
| 23 |
+
* @param array $options The importer options.
|
| 24 |
+
* @param object $logger The logger object.
|
| 25 |
+
*/
|
| 26 |
+
public function __construct( $options = array(), $logger = null ) {
|
| 27 |
+
parent::__construct( $options );
|
| 28 |
+
|
| 29 |
+
$this->set_logger( $logger );
|
| 30 |
+
|
| 31 |
+
// Check, if a new AJAX request is required.
|
| 32 |
+
add_filter( 'wxr_importer.pre_process.post', array( $this, 'new_ajax_request_maybe' ) );
|
| 33 |
+
|
| 34 |
+
// WooCommerce product attributes registration.
|
| 35 |
+
if ( class_exists( 'WooCommerce' ) ) {
|
| 36 |
+
add_filter( 'wxr_importer.pre_process.term', array( $this, 'woocommerce_product_attributes_registration' ), 10, 1 );
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Get the XML reader for the file.
|
| 42 |
+
*
|
| 43 |
+
* @param string $file Path to the XML file.
|
| 44 |
+
*
|
| 45 |
+
* @return XMLReader|boolean Reader instance on success, false otherwise.
|
| 46 |
+
*/
|
| 47 |
+
protected function get_reader( $file ) {
|
| 48 |
+
// Avoid loading external entities for security
|
| 49 |
+
$old_value = null;
|
| 50 |
+
if ( function_exists( 'libxml_disable_entity_loader' ) ) {
|
| 51 |
+
// $old_value = libxml_disable_entity_loader( true );
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if ( ! class_exists( 'XMLReader' ) ) {
|
| 55 |
+
$this->logger->critical( __( 'The XMLReader class is missing! Please install the XMLReader PHP extension on your server', 'wordpress-importer' ) );
|
| 56 |
+
|
| 57 |
+
return false;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
$reader = new XMLReader();
|
| 61 |
+
$status = $reader->open( $file );
|
| 62 |
+
|
| 63 |
+
if ( ! is_null( $old_value ) ) {
|
| 64 |
+
// libxml_disable_entity_loader( $old_value );
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
if ( ! $status ) {
|
| 68 |
+
$this->logger->error( __( 'Could not open the XML file for parsing!', 'wordpress-importer' ) );
|
| 69 |
+
|
| 70 |
+
return false;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
return $reader;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Get the basic import content data.
|
| 78 |
+
* Which elements are present in this import file (check possible elements in the $data variable)?
|
| 79 |
+
*
|
| 80 |
+
* @param $file
|
| 81 |
+
*
|
| 82 |
+
* @return array|bool
|
| 83 |
+
*/
|
| 84 |
+
public function get_basic_import_content_data( $file ) {
|
| 85 |
+
$data = array(
|
| 86 |
+
'users' => false,
|
| 87 |
+
'categories' => false,
|
| 88 |
+
'tags' => false,
|
| 89 |
+
'terms' => false,
|
| 90 |
+
'posts' => false,
|
| 91 |
+
);
|
| 92 |
+
|
| 93 |
+
// Get the XML reader and open the file.
|
| 94 |
+
$reader = $this->get_reader( $file );
|
| 95 |
+
|
| 96 |
+
if ( empty( $reader ) ) {
|
| 97 |
+
return false;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// Start parsing!
|
| 101 |
+
while ( $reader->read() ) {
|
| 102 |
+
// Only deal with element opens.
|
| 103 |
+
if ( $reader->nodeType !== XMLReader::ELEMENT ) {
|
| 104 |
+
continue;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
switch ( $reader->name ) {
|
| 108 |
+
case 'wp:author':
|
| 109 |
+
// Skip, if the users were already detected.
|
| 110 |
+
if ( $data['users'] ) {
|
| 111 |
+
$reader->next();
|
| 112 |
+
break;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
$node = $reader->expand();
|
| 116 |
+
$parsed = $this->parse_author_node( $node );
|
| 117 |
+
|
| 118 |
+
// Skip, if there was an error in parsing the author node.
|
| 119 |
+
if ( is_wp_error( $parsed ) ) {
|
| 120 |
+
$reader->next();
|
| 121 |
+
break;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
$data['users'] = true;
|
| 125 |
+
|
| 126 |
+
// Handled everything in this node, move on to the next.
|
| 127 |
+
$reader->next();
|
| 128 |
+
break;
|
| 129 |
+
|
| 130 |
+
case 'item':
|
| 131 |
+
// Skip, if the posts were already detected.
|
| 132 |
+
if ( $data['posts'] ) {
|
| 133 |
+
$reader->next();
|
| 134 |
+
break;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
$node = $reader->expand();
|
| 138 |
+
$parsed = $this->parse_post_node( $node );
|
| 139 |
+
|
| 140 |
+
// Skip, if there was an error in parsing the item node.
|
| 141 |
+
if ( is_wp_error( $parsed ) ) {
|
| 142 |
+
$reader->next();
|
| 143 |
+
break;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
$data['posts'] = true;
|
| 147 |
+
|
| 148 |
+
// Handled everything in this node, move on to the next
|
| 149 |
+
$reader->next();
|
| 150 |
+
break;
|
| 151 |
+
|
| 152 |
+
case 'wp:category':
|
| 153 |
+
$data['categories'] = true;
|
| 154 |
+
|
| 155 |
+
// Handled everything in this node, move on to the next
|
| 156 |
+
$reader->next();
|
| 157 |
+
break;
|
| 158 |
+
case 'wp:tag':
|
| 159 |
+
$data['tags'] = true;
|
| 160 |
+
|
| 161 |
+
// Handled everything in this node, move on to the next
|
| 162 |
+
$reader->next();
|
| 163 |
+
break;
|
| 164 |
+
case 'wp:term':
|
| 165 |
+
$data['terms'] = true;
|
| 166 |
+
|
| 167 |
+
// Handled everything in this node, move on to the next
|
| 168 |
+
$reader->next();
|
| 169 |
+
break;
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
return $data;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
/**
|
| 178 |
+
* Get the number of posts (posts, pages, CPT, attachments), that the import file has.
|
| 179 |
+
*
|
| 180 |
+
* @param $file
|
| 181 |
+
*
|
| 182 |
+
* @return int
|
| 183 |
+
*/
|
| 184 |
+
public function get_number_of_posts_to_import( $file ) {
|
| 185 |
+
$reader = $this->get_reader( $file );
|
| 186 |
+
$counter = 0;
|
| 187 |
+
|
| 188 |
+
if ( empty( $reader ) ) {
|
| 189 |
+
return $counter;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
// Start parsing!
|
| 193 |
+
while ( $reader->read() ) {
|
| 194 |
+
// Only deal with element opens.
|
| 195 |
+
if ( $reader->nodeType !== XMLReader::ELEMENT ) {
|
| 196 |
+
continue;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
if ( 'item' == $reader->name ) {
|
| 200 |
+
$node = $reader->expand();
|
| 201 |
+
$parsed = $this->parse_post_node( $node );
|
| 202 |
+
|
| 203 |
+
// Skip, if there was an error in parsing the item node.
|
| 204 |
+
if ( is_wp_error( $parsed ) ) {
|
| 205 |
+
$reader->next();
|
| 206 |
+
continue;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
$counter++;
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
return $counter;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
/**
|
| 217 |
+
* The main controller for the actual import stage.
|
| 218 |
+
*
|
| 219 |
+
* @param string $file Path to the WXR file for importing.
|
| 220 |
+
* @param array $options Import options (which parts to import).
|
| 221 |
+
*
|
| 222 |
+
* @return boolean
|
| 223 |
+
*/
|
| 224 |
+
public function import( $file, $options = array() ) {
|
| 225 |
+
add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
|
| 226 |
+
add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
|
| 227 |
+
|
| 228 |
+
// Start the import timer.
|
| 229 |
+
$this->start_time = microtime( true );
|
| 230 |
+
|
| 231 |
+
// Set the existing import data, from previous AJAX call, if any.
|
| 232 |
+
$this->restore_import_data_transient();
|
| 233 |
+
|
| 234 |
+
// Set the import options defaults.
|
| 235 |
+
if ( empty( $options ) ) {
|
| 236 |
+
$options = array(
|
| 237 |
+
'users' => false,
|
| 238 |
+
'categories' => true,
|
| 239 |
+
'tags' => true,
|
| 240 |
+
'terms' => true,
|
| 241 |
+
'posts' => true,
|
| 242 |
+
);
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
$result = $this->import_start( $file );
|
| 246 |
+
|
| 247 |
+
if ( is_wp_error( $result ) ) {
|
| 248 |
+
$this->logger->error( __( 'Content import start error: ', 'wordpress-importer' ) . $result->get_error_message() );
|
| 249 |
+
|
| 250 |
+
return false;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
// Get the actual XML reader.
|
| 254 |
+
$reader = $this->get_reader( $file );
|
| 255 |
+
|
| 256 |
+
if ( empty( $reader ) ) {
|
| 257 |
+
return false;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
// Set the version to compatibility mode first
|
| 261 |
+
$this->version = '1.0';
|
| 262 |
+
|
| 263 |
+
// Reset other variables
|
| 264 |
+
$this->base_url = '';
|
| 265 |
+
|
| 266 |
+
// Start parsing!
|
| 267 |
+
while ( $reader->read() ) {
|
| 268 |
+
// Only deal with element opens.
|
| 269 |
+
if ( $reader->nodeType !== XMLReader::ELEMENT ) {
|
| 270 |
+
continue;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
switch ( $reader->name ) {
|
| 274 |
+
case 'wp:wxr_version':
|
| 275 |
+
// Upgrade to the correct version
|
| 276 |
+
$this->version = $reader->readString();
|
| 277 |
+
|
| 278 |
+
if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
|
| 279 |
+
$this->logger->warning( sprintf(
|
| 280 |
+
__( 'This WXR file (version %s) is newer than the importer (version %s) and may not be supported. Please consider updating.', 'wordpress-importer' ),
|
| 281 |
+
$this->version,
|
| 282 |
+
self::MAX_WXR_VERSION
|
| 283 |
+
) );
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
// Handled everything in this node, move on to the next
|
| 287 |
+
$reader->next();
|
| 288 |
+
break;
|
| 289 |
+
|
| 290 |
+
case 'wp:base_site_url':
|
| 291 |
+
$this->base_url = $reader->readString();
|
| 292 |
+
|
| 293 |
+
// Handled everything in this node, move on to the next
|
| 294 |
+
$reader->next();
|
| 295 |
+
break;
|
| 296 |
+
|
| 297 |
+
case 'item':
|
| 298 |
+
if ( empty( $options['posts'] ) ) {
|
| 299 |
+
$reader->next();
|
| 300 |
+
break;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
$node = $reader->expand();
|
| 304 |
+
$parsed = $this->parse_post_node( $node );
|
| 305 |
+
|
| 306 |
+
if ( is_wp_error( $parsed ) ) {
|
| 307 |
+
$this->log_error( $parsed );
|
| 308 |
+
|
| 309 |
+
// Skip the rest of this post
|
| 310 |
+
$reader->next();
|
| 311 |
+
break;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
$this->process_post( $parsed['data'], $parsed['meta'], $parsed['comments'], $parsed['terms'] );
|
| 315 |
+
|
| 316 |
+
// Handled everything in this node, move on to the next
|
| 317 |
+
$reader->next();
|
| 318 |
+
break;
|
| 319 |
+
|
| 320 |
+
case 'wp:author':
|
| 321 |
+
if ( empty( $options['users'] ) ) {
|
| 322 |
+
$reader->next();
|
| 323 |
+
break;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
$node = $reader->expand();
|
| 327 |
+
$parsed = $this->parse_author_node( $node );
|
| 328 |
+
|
| 329 |
+
if ( is_wp_error( $parsed ) ) {
|
| 330 |
+
$this->log_error( $parsed );
|
| 331 |
+
|
| 332 |
+
// Skip the rest of this post
|
| 333 |
+
$reader->next();
|
| 334 |
+
break;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
$status = $this->process_author( $parsed['data'], $parsed['meta'] );
|
| 338 |
+
|
| 339 |
+
if ( is_wp_error( $status ) ) {
|
| 340 |
+
$this->log_error( $status );
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
// Handled everything in this node, move on to the next
|
| 344 |
+
$reader->next();
|
| 345 |
+
break;
|
| 346 |
+
|
| 347 |
+
case 'wp:category':
|
| 348 |
+
if ( empty( $options['categories'] ) ) {
|
| 349 |
+
$reader->next();
|
| 350 |
+
break;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
$node = $reader->expand();
|
| 354 |
+
$parsed = $this->parse_term_node( $node, 'category' );
|
| 355 |
+
|
| 356 |
+
if ( is_wp_error( $parsed ) ) {
|
| 357 |
+
$this->log_error( $parsed );
|
| 358 |
+
|
| 359 |
+
// Skip the rest of this post
|
| 360 |
+
$reader->next();
|
| 361 |
+
break;
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
$status = $this->process_term( $parsed['data'], $parsed['meta'] );
|
| 365 |
+
|
| 366 |
+
// Handled everything in this node, move on to the next
|
| 367 |
+
$reader->next();
|
| 368 |
+
break;
|
| 369 |
+
|
| 370 |
+
case 'wp:tag':
|
| 371 |
+
if ( empty( $options['tags'] ) ) {
|
| 372 |
+
$reader->next();
|
| 373 |
+
break;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
$node = $reader->expand();
|
| 377 |
+
$parsed = $this->parse_term_node( $node, 'tag' );
|
| 378 |
+
|
| 379 |
+
if ( is_wp_error( $parsed ) ) {
|
| 380 |
+
$this->log_error( $parsed );
|
| 381 |
+
|
| 382 |
+
// Skip the rest of this post
|
| 383 |
+
$reader->next();
|
| 384 |
+
break;
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
$status = $this->process_term( $parsed['data'], $parsed['meta'] );
|
| 388 |
+
|
| 389 |
+
// Handled everything in this node, move on to the next
|
| 390 |
+
$reader->next();
|
| 391 |
+
break;
|
| 392 |
+
|
| 393 |
+
case 'wp:term':
|
| 394 |
+
if ( empty( $options['terms'] ) ) {
|
| 395 |
+
$reader->next();
|
| 396 |
+
break;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
$node = $reader->expand();
|
| 400 |
+
$parsed = $this->parse_term_node( $node );
|
| 401 |
+
|
| 402 |
+
if ( is_wp_error( $parsed ) ) {
|
| 403 |
+
$this->log_error( $parsed );
|
| 404 |
+
|
| 405 |
+
// Skip the rest of this post
|
| 406 |
+
$reader->next();
|
| 407 |
+
break;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
$status = $this->process_term( $parsed['data'], $parsed['meta'] );
|
| 411 |
+
|
| 412 |
+
// Handled everything in this node, move on to the next
|
| 413 |
+
$reader->next();
|
| 414 |
+
break;
|
| 415 |
+
|
| 416 |
+
default:
|
| 417 |
+
// Skip this node, probably handled by something already
|
| 418 |
+
break;
|
| 419 |
+
}
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
// Now that we've done the main processing, do any required
|
| 423 |
+
// post-processing and remapping.
|
| 424 |
+
$this->post_process();
|
| 425 |
+
|
| 426 |
+
if ( $this->options['aggressive_url_search'] ) {
|
| 427 |
+
$this->replace_attachment_urls_in_content();
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
$this->remap_featured_images();
|
| 431 |
+
|
| 432 |
+
$this->import_end();
|
| 433 |
+
|
| 434 |
+
// Set the current importer state, so the data can be used on the next AJAX call.
|
| 435 |
+
$this->set_current_importer_data();
|
| 436 |
+
|
| 437 |
+
return true;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
/**
|
| 441 |
+
* Import users only.
|
| 442 |
+
*
|
| 443 |
+
* @param string $file Path to the import file.
|
| 444 |
+
*/
|
| 445 |
+
public function import_users( $file ) {
|
| 446 |
+
return $this->import( $file, array( 'users' => true ) );
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
/**
|
| 450 |
+
* Import categories only.
|
| 451 |
+
*
|
| 452 |
+
* @param string $file Path to the import file.
|
| 453 |
+
*/
|
| 454 |
+
public function import_categories( $file ) {
|
| 455 |
+
return $this->import( $file, array( 'categories' => true ) );
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
/**
|
| 459 |
+
* Import tags only.
|
| 460 |
+
*
|
| 461 |
+
* @param string $file Path to the import file.
|
| 462 |
+
*/
|
| 463 |
+
public function import_tags( $file ) {
|
| 464 |
+
return $this->import( $file, array( 'tags' => true ) );
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
/**
|
| 468 |
+
* Import terms only.
|
| 469 |
+
*
|
| 470 |
+
* @param string $file Path to the import file.
|
| 471 |
+
*/
|
| 472 |
+
public function import_terms( $file ) {
|
| 473 |
+
return $this->import( $file, array( 'terms' => true ) );
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
/**
|
| 477 |
+
* Import posts only.
|
| 478 |
+
*
|
| 479 |
+
* @param string $file Path to the import file.
|
| 480 |
+
*/
|
| 481 |
+
public function import_posts( $file ) {
|
| 482 |
+
return $this->import( $file, array( 'posts' => true ) );
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
/**
|
| 486 |
+
* Check if we need to create a new AJAX request, so that server does not timeout.
|
| 487 |
+
* And fix the import warning for missing post author.
|
| 488 |
+
*
|
| 489 |
+
* @param array $data current post data.
|
| 490 |
+
* @return array
|
| 491 |
+
*/
|
| 492 |
+
public function new_ajax_request_maybe( $data ) {
|
| 493 |
+
$time = microtime( true ) - $this->start_time;
|
| 494 |
+
|
| 495 |
+
// We should make a new ajax call, if the time is right.
|
| 496 |
+
if ( $time > apply_filters( 'pt-importer/time_for_one_ajax_call', 20 ) ) {
|
| 497 |
+
$response = apply_filters( 'pt-importer/new_ajax_request_response_data', array(
|
| 498 |
+
'status' => 'newAJAX',
|
| 499 |
+
'log' => 'Time for new AJAX request!: ' . $time,
|
| 500 |
+
'num_of_imported_posts' => count( $this->mapping['post'] ),
|
| 501 |
+
) );
|
| 502 |
+
|
| 503 |
+
// Add message to log file.
|
| 504 |
+
$this->logger->info( __( 'New AJAX call!', 'wordpress-importer' ) );
|
| 505 |
+
|
| 506 |
+
// Set the current importer state, so it can be continued on the next AJAX call.
|
| 507 |
+
$this->set_current_importer_data();
|
| 508 |
+
|
| 509 |
+
// Send the request for a new AJAX call.
|
| 510 |
+
wp_send_json( $response );
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
// Set importing author to the current user.
|
| 514 |
+
// Fixes the [WARNING] Could not find the author for ... log warning messages.
|
| 515 |
+
$current_user_obj = wp_get_current_user();
|
| 516 |
+
$data['post_author'] = $current_user_obj->user_login;
|
| 517 |
+
|
| 518 |
+
return $data;
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
/**
|
| 522 |
+
* Save current importer data to the DB, for later use.
|
| 523 |
+
*/
|
| 524 |
+
public function set_current_importer_data() {
|
| 525 |
+
$data = apply_filters( 'pt-importer/set_current_importer_data', array(
|
| 526 |
+
'options' => $this->options,
|
| 527 |
+
'mapping' => $this->mapping,
|
| 528 |
+
'requires_remapping' => $this->requires_remapping,
|
| 529 |
+
'exists' => $this->exists,
|
| 530 |
+
'user_slug_override' => $this->user_slug_override,
|
| 531 |
+
'url_remap' => $this->url_remap,
|
| 532 |
+
'featured_images' => $this->featured_images,
|
| 533 |
+
) );
|
| 534 |
+
|
| 535 |
+
$this->save_current_import_data_transient( $data );
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
/**
|
| 539 |
+
* Set the importer data to the transient.
|
| 540 |
+
*
|
| 541 |
+
* @param array $data Data to be saved to the transient.
|
| 542 |
+
*/
|
| 543 |
+
public function save_current_import_data_transient( $data ) {
|
| 544 |
+
set_transient( 'pt_importer_data', $data, MINUTE_IN_SECONDS );
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
/**
|
| 548 |
+
* Restore the importer data from the transient.
|
| 549 |
+
*
|
| 550 |
+
* @return boolean
|
| 551 |
+
*/
|
| 552 |
+
public function restore_import_data_transient() {
|
| 553 |
+
if ( $data = get_transient( 'pt_importer_data' ) ) {
|
| 554 |
+
$this->options = empty( $data['options'] ) ? array() : $data['options'];
|
| 555 |
+
$this->mapping = empty( $data['mapping'] ) ? array() : $data['mapping'];
|
| 556 |
+
$this->requires_remapping = empty( $data['requires_remapping'] ) ? array() : $data['requires_remapping'];
|
| 557 |
+
$this->exists = empty( $data['exists'] ) ? array() : $data['exists'];
|
| 558 |
+
$this->user_slug_override = empty( $data['user_slug_override'] ) ? array() : $data['user_slug_override'];
|
| 559 |
+
$this->url_remap = empty( $data['url_remap'] ) ? array() : $data['url_remap'];
|
| 560 |
+
$this->featured_images = empty( $data['featured_images'] ) ? array() : $data['featured_images'];
|
| 561 |
+
|
| 562 |
+
do_action( 'pt-importer/restore_import_data_transient' );
|
| 563 |
+
|
| 564 |
+
return true;
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
return false;
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
/**
|
| 571 |
+
* Get the importer mapping data.
|
| 572 |
+
*
|
| 573 |
+
* @return array An empty array or an array of mapping data.
|
| 574 |
+
*/
|
| 575 |
+
public function get_mapping() {
|
| 576 |
+
return $this->mapping;
|
| 577 |
+
}
|
| 578 |
+
|
| 579 |
+
/**
|
| 580 |
+
* Hook into the pre-process term filter of the content import and register the
|
| 581 |
+
* custom WooCommerce product attributes, so that the terms can then be imported normally.
|
| 582 |
+
*
|
| 583 |
+
* This should probably be removed once the WP importer 2.0 support is added in WooCommerce.
|
| 584 |
+
*
|
| 585 |
+
* Fixes: [WARNING] Failed to import pa_size L warnings in content import.
|
| 586 |
+
* Code from: woocommerce/includes/admin/class-wc-admin-importers.php (ver 2.6.9).
|
| 587 |
+
*
|
| 588 |
+
* Github issue: https://github.com/awesomemotive/one-click-demo-import/issues/71
|
| 589 |
+
*
|
| 590 |
+
* @param array $date The term data to import.
|
| 591 |
+
* @return array The unchanged term data.
|
| 592 |
+
*/
|
| 593 |
+
public function woocommerce_product_attributes_registration( $data ) {
|
| 594 |
+
global $wpdb;
|
| 595 |
+
|
| 596 |
+
if ( strstr( $data['taxonomy'], 'pa_' ) ) {
|
| 597 |
+
if ( ! taxonomy_exists( $data['taxonomy'] ) ) {
|
| 598 |
+
$attribute_name = wc_sanitize_taxonomy_name( str_replace( 'pa_', '', $data['taxonomy'] ) );
|
| 599 |
+
|
| 600 |
+
// Create the taxonomy
|
| 601 |
+
if ( ! in_array( $attribute_name, wc_get_attribute_taxonomies() ) ) {
|
| 602 |
+
$attribute = array(
|
| 603 |
+
'attribute_label' => $attribute_name,
|
| 604 |
+
'attribute_name' => $attribute_name,
|
| 605 |
+
'attribute_type' => 'select',
|
| 606 |
+
'attribute_orderby' => 'menu_order',
|
| 607 |
+
'attribute_public' => 0
|
| 608 |
+
);
|
| 609 |
+
$wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute );
|
| 610 |
+
delete_transient( 'wc_attribute_taxonomies' );
|
| 611 |
+
}
|
| 612 |
+
|
| 613 |
+
// Register the taxonomy now so that the import works!
|
| 614 |
+
register_taxonomy(
|
| 615 |
+
$data['taxonomy'],
|
| 616 |
+
apply_filters( 'woocommerce_taxonomy_objects_' . $data['taxonomy'], array( 'product' ) ),
|
| 617 |
+
apply_filters( 'woocommerce_taxonomy_args_' . $data['taxonomy'], array(
|
| 618 |
+
'hierarchical' => true,
|
| 619 |
+
'show_ui' => false,
|
| 620 |
+
'query_var' => true,
|
| 621 |
+
'rewrite' => false,
|
| 622 |
+
) )
|
| 623 |
+
);
|
| 624 |
+
}
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
return $data;
|
| 628 |
+
}
|
| 629 |
+
}
|
vendor/{proteusthemes → awesomemotive}/wp-content-importer-v2/src/WPImporterLogger.php
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
namespace
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Describes a logger instance
|
| 1 |
<?php
|
| 2 |
+
namespace AwesomeMotive\WPContentImporter2;
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Describes a logger instance
|
vendor/{proteusthemes → awesomemotive}/wp-content-importer-v2/src/WPImporterLoggerCLI.php
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
namespace
|
| 3 |
|
| 4 |
class WPImporterLoggerCLI extends WPImporterLogger {
|
| 5 |
public $min_level = 'notice';
|
| 1 |
<?php
|
| 2 |
+
namespace AwesomeMotive\WPContentImporter2;
|
| 3 |
|
| 4 |
class WPImporterLoggerCLI extends WPImporterLogger {
|
| 5 |
public $min_level = 'notice';
|
vendor/{proteusthemes → awesomemotive}/wp-content-importer-v2/src/WXRImportInfo.php
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
namespace
|
| 4 |
|
| 5 |
class WXRImportInfo {
|
| 6 |
public $home;
|
|
@@ -13,4 +13,4 @@ class WXRImportInfo {
|
|
| 13 |
public $term_count = 0;
|
| 14 |
public $generator = '';
|
| 15 |
public $version;
|
| 16 |
-
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
namespace AwesomeMotive\WPContentImporter2;
|
| 4 |
|
| 5 |
class WXRImportInfo {
|
| 6 |
public $home;
|
| 13 |
public $term_count = 0;
|
| 14 |
public $generator = '';
|
| 15 |
public $version;
|
| 16 |
+
}
|
vendor/{proteusthemes → awesomemotive}/wp-content-importer-v2/src/WXRImporter.php
RENAMED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
<?php
|
| 2 |
-
namespace
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
class WXRImporter extends \WP_Importer {
|
| 5 |
/**
|
|
@@ -49,6 +52,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 49 |
protected $missing_menu_items = array();
|
| 50 |
|
| 51 |
// NEW STYLE
|
|
|
|
| 52 |
protected $mapping = array();
|
| 53 |
protected $requires_remapping = array();
|
| 54 |
protected $exists = array();
|
|
@@ -60,7 +64,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 60 |
/**
|
| 61 |
* Logger instance.
|
| 62 |
*
|
| 63 |
-
* @var
|
| 64 |
*/
|
| 65 |
protected $logger;
|
| 66 |
|
|
@@ -71,7 +75,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 71 |
* @var bool $prefill_existing_posts Should we prefill `post_exists` calls? (True prefills and uses more memory, false checks once per imported post and takes longer. Default is true.)
|
| 72 |
* @var bool $prefill_existing_comments Should we prefill `comment_exists` calls? (True prefills and uses more memory, false checks once per imported comment and takes longer. Default is true.)
|
| 73 |
* @var bool $prefill_existing_terms Should we prefill `term_exists` calls? (True prefills and uses more memory, false checks once per imported term and takes longer. Default is true.)
|
| 74 |
-
* @var bool $update_attachment_guids Should attachment GUIDs be updated to the new URL? (True updates the GUID, which keeps compatibility with v1, false doesn't update, and allows
|
| 75 |
* @var bool $fetch_attachments Fetch attachments from the remote server. (True fetches and creates attachment posts, false skips attachments. Default is false.)
|
| 76 |
* @var bool $aggressive_url_search Should we search/replace for URLs aggressively? (True searches all posts' content for old URLs and replaces, false checks for `<img class="wp-image-*">` only. Default is false.)
|
| 77 |
* @var int $default_author User ID to use if author is missing or invalid. (Default is null, which leaves posts unassigned.)
|
|
@@ -120,7 +124,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 120 |
// $old_value = libxml_disable_entity_loader( true );
|
| 121 |
}
|
| 122 |
|
| 123 |
-
$reader = new
|
| 124 |
$status = $reader->open( $file );
|
| 125 |
|
| 126 |
if ( ! is_null( $old_value ) ) {
|
|
@@ -128,7 +132,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 128 |
}
|
| 129 |
|
| 130 |
if ( ! $status ) {
|
| 131 |
-
return new
|
| 132 |
}
|
| 133 |
|
| 134 |
return $reader;
|
|
@@ -138,6 +142,8 @@ class WXRImporter extends \WP_Importer {
|
|
| 138 |
* The main controller for the actual import stage.
|
| 139 |
*
|
| 140 |
* @param string $file Path to the WXR file for importing
|
|
|
|
|
|
|
| 141 |
*/
|
| 142 |
public function get_preliminary_information( $file ) {
|
| 143 |
// Let's run the actual importer now, woot
|
|
@@ -153,7 +159,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 153 |
$data = new WXRImportInfo();
|
| 154 |
while ( $reader->read() ) {
|
| 155 |
// Only deal with element opens
|
| 156 |
-
if ( $reader->nodeType !==
|
| 157 |
continue;
|
| 158 |
}
|
| 159 |
|
|
@@ -254,6 +260,8 @@ class WXRImporter extends \WP_Importer {
|
|
| 254 |
* The main controller for the actual import stage.
|
| 255 |
*
|
| 256 |
* @param string $file Path to the WXR file for importing
|
|
|
|
|
|
|
| 257 |
*/
|
| 258 |
public function parse_authors( $file ) {
|
| 259 |
// Let's run the actual importer now, woot
|
|
@@ -269,7 +277,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 269 |
$authors = array();
|
| 270 |
while ( $reader->read() ) {
|
| 271 |
// Only deal with element opens
|
| 272 |
-
if ( $reader->nodeType !==
|
| 273 |
continue;
|
| 274 |
}
|
| 275 |
|
|
@@ -316,7 +324,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 316 |
/**
|
| 317 |
* The main controller for the actual import stage.
|
| 318 |
*
|
| 319 |
-
* @param string $file Path to the WXR file for importing
|
| 320 |
*/
|
| 321 |
public function import( $file ) {
|
| 322 |
add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
|
|
@@ -342,7 +350,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 342 |
// Start parsing!
|
| 343 |
while ( $reader->read() ) {
|
| 344 |
// Only deal with element opens
|
| 345 |
-
if ( $reader->nodeType !==
|
| 346 |
continue;
|
| 347 |
}
|
| 348 |
|
|
@@ -503,7 +511,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 503 |
*/
|
| 504 |
protected function import_start( $file ) {
|
| 505 |
if ( ! is_file( $file ) ) {
|
| 506 |
-
return new
|
| 507 |
}
|
| 508 |
|
| 509 |
// Suspend bunches of stuff in WP core
|
|
@@ -538,6 +546,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 538 |
// Re-enable stuff in core
|
| 539 |
wp_suspend_cache_invalidation( false );
|
| 540 |
wp_cache_flush();
|
|
|
|
| 541 |
foreach ( get_taxonomies() as $tax ) {
|
| 542 |
delete_option( "{$tax}_children" );
|
| 543 |
_get_term_hierarchy( $tax );
|
|
@@ -546,6 +555,8 @@ class WXRImporter extends \WP_Importer {
|
|
| 546 |
wp_defer_term_counting( false );
|
| 547 |
wp_defer_comment_counting( false );
|
| 548 |
|
|
|
|
|
|
|
| 549 |
/**
|
| 550 |
* Complete the import.
|
| 551 |
*
|
|
@@ -593,7 +604,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 593 |
/**
|
| 594 |
* Parse a post node into post data.
|
| 595 |
*
|
| 596 |
-
* @param
|
| 597 |
* @return array|WP_Error Post data array on success, error otherwise.
|
| 598 |
*/
|
| 599 |
protected function parse_post_node( $node ) {
|
|
@@ -662,7 +673,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 662 |
|
| 663 |
if ( $data['post_status'] === 'auto-draft' ) {
|
| 664 |
// Bail now
|
| 665 |
-
return new
|
| 666 |
'wxr_importer.post.cannot_import_draft',
|
| 667 |
__( 'Cannot import auto-draft posts' ),
|
| 668 |
$data
|
|
@@ -723,6 +734,11 @@ class WXRImporter extends \WP_Importer {
|
|
| 723 |
* Doesn't create a new post if: the post type doesn't exist, the given post ID
|
| 724 |
* is already noted as imported or a post with the same title and date already exists.
|
| 725 |
* Note that new/updated terms, comments and meta are imported for the last of the above.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 726 |
*/
|
| 727 |
protected function process_post( $data, $meta, $comments, $terms ) {
|
| 728 |
/**
|
|
@@ -740,11 +756,10 @@ class WXRImporter extends \WP_Importer {
|
|
| 740 |
|
| 741 |
$original_id = isset( $data['post_id'] ) ? (int) $data['post_id'] : 0;
|
| 742 |
$parent_id = isset( $data['post_parent'] ) ? (int) $data['post_parent'] : 0;
|
| 743 |
-
$author_id = isset( $data['post_author'] ) ? (int) $data['post_author'] : 0;
|
| 744 |
|
| 745 |
// Have we already processed this?
|
| 746 |
if ( isset( $this->mapping['post'][ $original_id ] ) ) {
|
| 747 |
-
return;
|
| 748 |
}
|
| 749 |
|
| 750 |
$post_type_object = get_post_type_object( $data['post_type'] );
|
|
@@ -835,7 +850,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 835 |
$postdata[ $key ] = $data[ $key ];
|
| 836 |
}
|
| 837 |
|
| 838 |
-
$postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $data );
|
| 839 |
|
| 840 |
if ( 'attachment' === $postdata['post_type'] ) {
|
| 841 |
if ( ! $this->options['fetch_attachments'] ) {
|
|
@@ -983,7 +998,9 @@ class WXRImporter extends \WP_Importer {
|
|
| 983 |
* represents doesn't exist then the menu item will not be imported (waits until the
|
| 984 |
* end of the import to retry again before discarding).
|
| 985 |
*
|
| 986 |
-
* @param
|
|
|
|
|
|
|
| 987 |
*/
|
| 988 |
protected function process_menu_item_meta( $post_id, $data, $meta ) {
|
| 989 |
|
|
@@ -1041,8 +1058,10 @@ class WXRImporter extends \WP_Importer {
|
|
| 1041 |
/**
|
| 1042 |
* If fetching attachments is enabled then attempt to create a new attachment
|
| 1043 |
*
|
| 1044 |
-
* @param array
|
| 1045 |
-
* @param
|
|
|
|
|
|
|
| 1046 |
* @return int|WP_Error Post ID on success, WP_Error otherwise
|
| 1047 |
*/
|
| 1048 |
protected function process_attachment( $post, $meta, $remote_url ) {
|
|
@@ -1072,7 +1091,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 1072 |
|
| 1073 |
$info = wp_check_filetype( $upload['file'] );
|
| 1074 |
if ( ! $info ) {
|
| 1075 |
-
return new
|
| 1076 |
}
|
| 1077 |
|
| 1078 |
$post['post_mime_type'] = $info['type'];
|
|
@@ -1120,7 +1139,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 1120 |
/**
|
| 1121 |
* Parse a meta node into meta data.
|
| 1122 |
*
|
| 1123 |
-
* @param
|
| 1124 |
* @return array|null Meta data array on success, or null on error.
|
| 1125 |
*/
|
| 1126 |
protected function parse_meta_node( $node ) {
|
|
@@ -1192,7 +1211,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 1192 |
$value = maybe_unserialize( $meta_item['value'] );
|
| 1193 |
}
|
| 1194 |
|
| 1195 |
-
add_post_meta( $post_id, $key, $value );
|
| 1196 |
do_action( 'import_post_meta', $post_id, $key, $value );
|
| 1197 |
|
| 1198 |
// if the post has a featured image, take note of this in case of remap
|
|
@@ -1208,7 +1227,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 1208 |
/**
|
| 1209 |
* Parse a comment node into comment data.
|
| 1210 |
*
|
| 1211 |
-
* @param
|
| 1212 |
* @return array Comment data array.
|
| 1213 |
*/
|
| 1214 |
protected function parse_comment_node( $node ) {
|
|
@@ -1285,9 +1304,11 @@ class WXRImporter extends \WP_Importer {
|
|
| 1285 |
/**
|
| 1286 |
* Process and import comment data.
|
| 1287 |
*
|
| 1288 |
-
* @param array
|
| 1289 |
-
* @param int
|
| 1290 |
-
* @param array
|
|
|
|
|
|
|
| 1291 |
* @return int|WP_Error Number of comments imported on success, error otherwise.
|
| 1292 |
*/
|
| 1293 |
protected function process_comments( $comments, $post_id, $post, $post_exists = false ) {
|
|
@@ -1405,6 +1426,13 @@ class WXRImporter extends \WP_Importer {
|
|
| 1405 |
return $num_comments;
|
| 1406 |
}
|
| 1407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1408 |
protected function parse_category_node( $node ) {
|
| 1409 |
$data = array(
|
| 1410 |
// Default taxonomy to "category", since this is a `<category>` tag
|
|
@@ -1438,6 +1466,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 1438 |
*
|
| 1439 |
* @param array $a Comment data for the first comment
|
| 1440 |
* @param array $b Comment data for the second comment
|
|
|
|
| 1441 |
* @return int
|
| 1442 |
*/
|
| 1443 |
public static function sort_comments_by_id( $a, $b ) {
|
|
@@ -1491,6 +1520,12 @@ class WXRImporter extends \WP_Importer {
|
|
| 1491 |
return compact( 'data', 'meta' );
|
| 1492 |
}
|
| 1493 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1494 |
protected function process_author( $data, $meta ) {
|
| 1495 |
/**
|
| 1496 |
* Pre-process user data.
|
|
@@ -1595,6 +1630,15 @@ class WXRImporter extends \WP_Importer {
|
|
| 1595 |
do_action( 'wxr_importer.processed.user', $user_id, $userdata );
|
| 1596 |
}
|
| 1597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1598 |
protected function parse_term_node( $node, $type = 'term' ) {
|
| 1599 |
$data = array();
|
| 1600 |
$meta = array();
|
|
@@ -1661,6 +1705,12 @@ class WXRImporter extends \WP_Importer {
|
|
| 1661 |
return compact( 'data', 'meta' );
|
| 1662 |
}
|
| 1663 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1664 |
protected function process_term( $data, $meta ) {
|
| 1665 |
/**
|
| 1666 |
* Pre-process term data.
|
|
@@ -1796,9 +1846,10 @@ class WXRImporter extends \WP_Importer {
|
|
| 1796 |
/**
|
| 1797 |
* Process and import term meta items.
|
| 1798 |
*
|
| 1799 |
-
* @param array $meta
|
| 1800 |
-
* @param int
|
| 1801 |
-
* @param array $term
|
|
|
|
| 1802 |
* @return int|bool Number of meta items imported on success, false otherwise.
|
| 1803 |
*/
|
| 1804 |
protected function process_term_meta( $meta, $term_id, $term ) {
|
|
@@ -1856,10 +1907,11 @@ class WXRImporter extends \WP_Importer {
|
|
| 1856 |
}
|
| 1857 |
|
| 1858 |
/**
|
| 1859 |
-
* Attempt to download a remote file attachment
|
|
|
|
|
|
|
|
|
|
| 1860 |
*
|
| 1861 |
-
* @param string $url URL of item to fetch
|
| 1862 |
-
* @param array $post Attachment details
|
| 1863 |
* @return array|WP_Error Local file location details on success, WP_Error otherwise
|
| 1864 |
*/
|
| 1865 |
protected function fetch_remote_file( $url, $post ) {
|
|
@@ -1869,7 +1921,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 1869 |
// get placeholder file in the upload dir with a unique, sanitized filename
|
| 1870 |
$upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
|
| 1871 |
if ( $upload['error'] ) {
|
| 1872 |
-
return new
|
| 1873 |
}
|
| 1874 |
|
| 1875 |
// fetch the remote url and write it to the placeholder file
|
|
@@ -1889,7 +1941,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 1889 |
// make sure the fetch was successful
|
| 1890 |
if ( $code !== 200 ) {
|
| 1891 |
unlink( $upload['file'] );
|
| 1892 |
-
return new
|
| 1893 |
'import_file_error',
|
| 1894 |
sprintf(
|
| 1895 |
__( 'Remote server returned %1$d %2$s for %3$s', 'wordpress-importer' ),
|
|
@@ -1909,19 +1961,19 @@ class WXRImporter extends \WP_Importer {
|
|
| 1909 |
//
|
| 1910 |
// if ( isset( $headers['content-length'] ) && $filesize !== (int) $headers['content-length'] ) {
|
| 1911 |
// unlink( $upload['file'] );
|
| 1912 |
-
// return new
|
| 1913 |
// }
|
| 1914 |
|
| 1915 |
if ( 0 === $filesize ) {
|
| 1916 |
unlink( $upload['file'] );
|
| 1917 |
-
return new
|
| 1918 |
}
|
| 1919 |
|
| 1920 |
$max_size = (int) $this->max_attachment_size();
|
| 1921 |
if ( ! empty( $max_size ) && $filesize > $max_size ) {
|
| 1922 |
unlink( $upload['file'] );
|
| 1923 |
$message = sprintf( __( 'Remote file is too large, limit is %s', 'wordpress-importer' ), size_format( $max_size ) );
|
| 1924 |
-
return new
|
| 1925 |
}
|
| 1926 |
|
| 1927 |
return $upload;
|
|
@@ -2126,7 +2178,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 2126 |
}
|
| 2127 |
|
| 2128 |
// Run the update
|
| 2129 |
-
$data['comment_ID'] = $
|
| 2130 |
$result = wp_update_comment( wp_slash( $data ) );
|
| 2131 |
if ( empty( $result ) ) {
|
| 2132 |
$this->logger->warning( sprintf(
|
|
@@ -2151,6 +2203,8 @@ class WXRImporter extends \WP_Importer {
|
|
| 2151 |
* Top-level siblings without an explicit root parent, shall be identified
|
| 2152 |
* with the parent_slug: top
|
| 2153 |
* [we'll map parent_slug: top into parent 0]
|
|
|
|
|
|
|
| 2154 |
*/
|
| 2155 |
protected function post_process_terms( $terms_to_be_remapped ) {
|
| 2156 |
$this->mapping['term_slug']['top'] = 0;
|
|
@@ -2175,7 +2229,6 @@ class WXRImporter extends \WP_Importer {
|
|
| 2175 |
continue;
|
| 2176 |
}
|
| 2177 |
|
| 2178 |
-
$data = array();
|
| 2179 |
$parent_slug = get_term_meta( $term_id, '_wxr_import_parent', true );
|
| 2180 |
|
| 2181 |
if ( empty( $parent_slug ) ) {
|
|
@@ -2254,7 +2307,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 2254 |
|
| 2255 |
// remap enclosure urls
|
| 2256 |
$query = $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'", $from_url, $to_url );
|
| 2257 |
-
$
|
| 2258 |
}
|
| 2259 |
}
|
| 2260 |
|
|
@@ -2312,6 +2365,7 @@ class WXRImporter extends \WP_Importer {
|
|
| 2312 |
/**
|
| 2313 |
* Added to http_request_timeout filter to force timeout at 60 seconds during import
|
| 2314 |
*
|
|
|
|
| 2315 |
* @access protected
|
| 2316 |
* @return int 60
|
| 2317 |
*/
|
| 1 |
<?php
|
| 2 |
+
namespace AwesomeMotive\WPContentImporter2;
|
| 3 |
+
|
| 4 |
+
use WP_Error;
|
| 5 |
+
use XMLReader;
|
| 6 |
|
| 7 |
class WXRImporter extends \WP_Importer {
|
| 8 |
/**
|
| 52 |
protected $missing_menu_items = array();
|
| 53 |
|
| 54 |
// NEW STYLE
|
| 55 |
+
public $options = array();
|
| 56 |
protected $mapping = array();
|
| 57 |
protected $requires_remapping = array();
|
| 58 |
protected $exists = array();
|
| 64 |
/**
|
| 65 |
* Logger instance.
|
| 66 |
*
|
| 67 |
+
* @var WPImporterLogger
|
| 68 |
*/
|
| 69 |
protected $logger;
|
| 70 |
|
| 75 |
* @var bool $prefill_existing_posts Should we prefill `post_exists` calls? (True prefills and uses more memory, false checks once per imported post and takes longer. Default is true.)
|
| 76 |
* @var bool $prefill_existing_comments Should we prefill `comment_exists` calls? (True prefills and uses more memory, false checks once per imported comment and takes longer. Default is true.)
|
| 77 |
* @var bool $prefill_existing_terms Should we prefill `term_exists` calls? (True prefills and uses more memory, false checks once per imported term and takes longer. Default is true.)
|
| 78 |
+
* @var bool $update_attachment_guids Should attachment GUIDs be updated to the new URL? (True updates the GUID, which keeps compatibility with v1, false doesn't update, and allows duplication and reimporting. Default is false.)
|
| 79 |
* @var bool $fetch_attachments Fetch attachments from the remote server. (True fetches and creates attachment posts, false skips attachments. Default is false.)
|
| 80 |
* @var bool $aggressive_url_search Should we search/replace for URLs aggressively? (True searches all posts' content for old URLs and replaces, false checks for `<img class="wp-image-*">` only. Default is false.)
|
| 81 |
* @var int $default_author User ID to use if author is missing or invalid. (Default is null, which leaves posts unassigned.)
|
| 124 |
// $old_value = libxml_disable_entity_loader( true );
|
| 125 |
}
|
| 126 |
|
| 127 |
+
$reader = new XMLReader();
|
| 128 |
$status = $reader->open( $file );
|
| 129 |
|
| 130 |
if ( ! is_null( $old_value ) ) {
|
| 132 |
}
|
| 133 |
|
| 134 |
if ( ! $status ) {
|
| 135 |
+
return new WP_Error( 'wxr_importer.cannot_parse', __( 'Could not open the file for parsing', 'wordpress-importer' ) );
|
| 136 |
}
|
| 137 |
|
| 138 |
return $reader;
|
| 142 |
* The main controller for the actual import stage.
|
| 143 |
*
|
| 144 |
* @param string $file Path to the WXR file for importing
|
| 145 |
+
*
|
| 146 |
+
* @return WXRImportInfo|WP_Error
|
| 147 |
*/
|
| 148 |
public function get_preliminary_information( $file ) {
|
| 149 |
// Let's run the actual importer now, woot
|
| 159 |
$data = new WXRImportInfo();
|
| 160 |
while ( $reader->read() ) {
|
| 161 |
// Only deal with element opens
|
| 162 |
+
if ( $reader->nodeType !== XMLReader::ELEMENT ) {
|
| 163 |
continue;
|
| 164 |
}
|
| 165 |
|
| 260 |
* The main controller for the actual import stage.
|
| 261 |
*
|
| 262 |
* @param string $file Path to the WXR file for importing
|
| 263 |
+
*
|
| 264 |
+
* @return array|WP_Error
|
| 265 |
*/
|
| 266 |
public function parse_authors( $file ) {
|
| 267 |
// Let's run the actual importer now, woot
|
| 277 |
$authors = array();
|
| 278 |
while ( $reader->read() ) {
|
| 279 |
// Only deal with element opens
|
| 280 |
+
if ( $reader->nodeType !== XMLReader::ELEMENT ) {
|
| 281 |
continue;
|
| 282 |
}
|
| 283 |
|
| 324 |
/**
|
| 325 |
* The main controller for the actual import stage.
|
| 326 |
*
|
| 327 |
+
* @param string $file Path to the WXR file for importing.
|
| 328 |
*/
|
| 329 |
public function import( $file ) {
|
| 330 |
add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
|
| 350 |
// Start parsing!
|
| 351 |
while ( $reader->read() ) {
|
| 352 |
// Only deal with element opens
|
| 353 |
+
if ( $reader->nodeType !== XMLReader::ELEMENT ) {
|
| 354 |
continue;
|
| 355 |
}
|
| 356 |
|
| 511 |
*/
|
| 512 |
protected function import_start( $file ) {
|
| 513 |
if ( ! is_file( $file ) ) {
|
| 514 |
+
return new WP_Error( 'wxr_importer.file_missing', __( 'The file does not exist, please try again.', 'wordpress-importer' ) );
|
| 515 |
}
|
| 516 |
|
| 517 |
// Suspend bunches of stuff in WP core
|
| 546 |
// Re-enable stuff in core
|
| 547 |
wp_suspend_cache_invalidation( false );
|
| 548 |
wp_cache_flush();
|
| 549 |
+
|
| 550 |
foreach ( get_taxonomies() as $tax ) {
|
| 551 |
delete_option( "{$tax}_children" );
|
| 552 |
_get_term_hierarchy( $tax );
|
| 555 |
wp_defer_term_counting( false );
|
| 556 |
wp_defer_comment_counting( false );
|
| 557 |
|
| 558 |
+
flush_rewrite_rules();
|
| 559 |
+
|
| 560 |
/**
|
| 561 |
* Complete the import.
|
| 562 |
*
|
| 604 |
/**
|
| 605 |
* Parse a post node into post data.
|
| 606 |
*
|
| 607 |
+
* @param \DOMNode $node Parent node of post data (typically `item`).
|
| 608 |
* @return array|WP_Error Post data array on success, error otherwise.
|
| 609 |
*/
|
| 610 |
protected function parse_post_node( $node ) {
|
| 673 |
|
| 674 |
if ( $data['post_status'] === 'auto-draft' ) {
|
| 675 |
// Bail now
|
| 676 |
+
return new WP_Error(
|
| 677 |
'wxr_importer.post.cannot_import_draft',
|
| 678 |
__( 'Cannot import auto-draft posts' ),
|
| 679 |
$data
|
| 734 |
* Doesn't create a new post if: the post type doesn't exist, the given post ID
|
| 735 |
* is already noted as imported or a post with the same title and date already exists.
|
| 736 |
* Note that new/updated terms, comments and meta are imported for the last of the above.
|
| 737 |
+
*
|
| 738 |
+
* @param array $data Post data.
|
| 739 |
+
* @param array $meta Meta data.
|
| 740 |
+
* @param array $comments Comments on the post.
|
| 741 |
+
* @param array $terms Terms on the post.
|
| 742 |
*/
|
| 743 |
protected function process_post( $data, $meta, $comments, $terms ) {
|
| 744 |
/**
|
| 756 |
|
| 757 |
$original_id = isset( $data['post_id'] ) ? (int) $data['post_id'] : 0;
|
| 758 |
$parent_id = isset( $data['post_parent'] ) ? (int) $data['post_parent'] : 0;
|
|
|
|
| 759 |
|
| 760 |
// Have we already processed this?
|
| 761 |
if ( isset( $this->mapping['post'][ $original_id ] ) ) {
|
| 762 |
+
return false;
|
| 763 |
}
|
| 764 |
|
| 765 |
$post_type_object = get_post_type_object( $data['post_type'] );
|
| 850 |
$postdata[ $key ] = $data[ $key ];
|
| 851 |
}
|
| 852 |
|
| 853 |
+
$postdata = apply_filters( 'wp_import_post_data_processed', wp_slash( $postdata ), $data );
|
| 854 |
|
| 855 |
if ( 'attachment' === $postdata['post_type'] ) {
|
| 856 |
if ( ! $this->options['fetch_attachments'] ) {
|
| 998 |
* represents doesn't exist then the menu item will not be imported (waits until the
|
| 999 |
* end of the import to retry again before discarding).
|
| 1000 |
*
|
| 1001 |
+
* @param int $post_id Menu item post ID.
|
| 1002 |
+
* @param array $data Menu item details from WXR file.
|
| 1003 |
+
* @param array $meta Menu item meta details.
|
| 1004 |
*/
|
| 1005 |
protected function process_menu_item_meta( $post_id, $data, $meta ) {
|
| 1006 |
|
| 1058 |
/**
|
| 1059 |
* If fetching attachments is enabled then attempt to create a new attachment
|
| 1060 |
*
|
| 1061 |
+
* @param array $post Attachment post details from WXR.
|
| 1062 |
+
* @param array $meta Attachment post meta details.
|
| 1063 |
+
* @param string $remote_url URL to fetch attachment from.
|
| 1064 |
+
*
|
| 1065 |
* @return int|WP_Error Post ID on success, WP_Error otherwise
|
| 1066 |
*/
|
| 1067 |
protected function process_attachment( $post, $meta, $remote_url ) {
|
| 1091 |
|
| 1092 |
$info = wp_check_filetype( $upload['file'] );
|
| 1093 |
if ( ! $info ) {
|
| 1094 |
+
return new WP_Error( 'attachment_processing_error', __( 'Invalid file type', 'wordpress-importer' ) );
|
| 1095 |
}
|
| 1096 |
|
| 1097 |
$post['post_mime_type'] = $info['type'];
|
| 1139 |
/**
|
| 1140 |
* Parse a meta node into meta data.
|
| 1141 |
*
|
| 1142 |
+
* @param \DOMNode $node Parent node of meta data (typically `wp:postmeta` or `wp:commentmeta`).
|
| 1143 |
* @return array|null Meta data array on success, or null on error.
|
| 1144 |
*/
|
| 1145 |
protected function parse_meta_node( $node ) {
|
| 1211 |
$value = maybe_unserialize( $meta_item['value'] );
|
| 1212 |
}
|
| 1213 |
|
| 1214 |
+
add_post_meta( $post_id, wp_slash( $key ), wp_slash_strings_only( $value ) );
|
| 1215 |
do_action( 'import_post_meta', $post_id, $key, $value );
|
| 1216 |
|
| 1217 |
// if the post has a featured image, take note of this in case of remap
|
| 1227 |
/**
|
| 1228 |
* Parse a comment node into comment data.
|
| 1229 |
*
|
| 1230 |
+
* @param \DOMNode $node Parent node of comment data (typically `wp:comment`).
|
| 1231 |
* @return array Comment data array.
|
| 1232 |
*/
|
| 1233 |
protected function parse_comment_node( $node ) {
|
| 1304 |
/**
|
| 1305 |
* Process and import comment data.
|
| 1306 |
*
|
| 1307 |
+
* @param array $comments List of comment data arrays.
|
| 1308 |
+
* @param int $post_id Post to associate with.
|
| 1309 |
+
* @param array $post Post data.
|
| 1310 |
+
* @param boolean $post_exists Boolean if the post already exists.
|
| 1311 |
+
*
|
| 1312 |
* @return int|WP_Error Number of comments imported on success, error otherwise.
|
| 1313 |
*/
|
| 1314 |
protected function process_comments( $comments, $post_id, $post, $post_exists = false ) {
|
| 1426 |
return $num_comments;
|
| 1427 |
}
|
| 1428 |
|
| 1429 |
+
/**
|
| 1430 |
+
* Parse the category node.
|
| 1431 |
+
*
|
| 1432 |
+
* @param \DOMNode $node The category node.
|
| 1433 |
+
*
|
| 1434 |
+
* @return array|null
|
| 1435 |
+
*/
|
| 1436 |
protected function parse_category_node( $node ) {
|
| 1437 |
$data = array(
|
| 1438 |
// Default taxonomy to "category", since this is a `<category>` tag
|
| 1466 |
*
|
| 1467 |
* @param array $a Comment data for the first comment
|
| 1468 |
* @param array $b Comment data for the second comment
|
| 1469 |
+
*
|
| 1470 |
* @return int
|
| 1471 |
*/
|
| 1472 |
public static function sort_comments_by_id( $a, $b ) {
|
| 1520 |
return compact( 'data', 'meta' );
|
| 1521 |
}
|
| 1522 |
|
| 1523 |
+
/**
|
| 1524 |
+
* Process author.
|
| 1525 |
+
*
|
| 1526 |
+
* @param array $data The author data from WXR file.
|
| 1527 |
+
* @param array $meta The author meta data from WXR file.
|
| 1528 |
+
*/
|
| 1529 |
protected function process_author( $data, $meta ) {
|
| 1530 |
/**
|
| 1531 |
* Pre-process user data.
|
| 1630 |
do_action( 'wxr_importer.processed.user', $user_id, $userdata );
|
| 1631 |
}
|
| 1632 |
|
| 1633 |
+
|
| 1634 |
+
/**
|
| 1635 |
+
* Parse term node.
|
| 1636 |
+
*
|
| 1637 |
+
* @param \DOMNode $node The term node from WXR file.
|
| 1638 |
+
* @param string $type The type of the term node.
|
| 1639 |
+
*
|
| 1640 |
+
* @return array|null
|
| 1641 |
+
*/
|
| 1642 |
protected function parse_term_node( $node, $type = 'term' ) {
|
| 1643 |
$data = array();
|
| 1644 |
$meta = array();
|
| 1705 |
return compact( 'data', 'meta' );
|
| 1706 |
}
|
| 1707 |
|
| 1708 |
+
/**
|
| 1709 |
+
* Process term.
|
| 1710 |
+
*
|
| 1711 |
+
* @param array $data The term data from WXR file.
|
| 1712 |
+
* @param array $meta The term meta data from WXR file.
|
| 1713 |
+
*/
|
| 1714 |
protected function process_term( $data, $meta ) {
|
| 1715 |
/**
|
| 1716 |
* Pre-process term data.
|
| 1846 |
/**
|
| 1847 |
* Process and import term meta items.
|
| 1848 |
*
|
| 1849 |
+
* @param array $meta List of meta data arrays.
|
| 1850 |
+
* @param int $term_id Term ID to associate with.
|
| 1851 |
+
* @param array $term Term data.
|
| 1852 |
+
*
|
| 1853 |
* @return int|bool Number of meta items imported on success, false otherwise.
|
| 1854 |
*/
|
| 1855 |
protected function process_term_meta( $meta, $term_id, $term ) {
|
| 1907 |
}
|
| 1908 |
|
| 1909 |
/**
|
| 1910 |
+
* Attempt to download a remote file attachment.
|
| 1911 |
+
*
|
| 1912 |
+
* @param string $url URL of item to fetch.
|
| 1913 |
+
* @param array $post Attachment details.
|
| 1914 |
*
|
|
|
|
|
|
|
| 1915 |
* @return array|WP_Error Local file location details on success, WP_Error otherwise
|
| 1916 |
*/
|
| 1917 |
protected function fetch_remote_file( $url, $post ) {
|
| 1921 |
// get placeholder file in the upload dir with a unique, sanitized filename
|
| 1922 |
$upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
|
| 1923 |
if ( $upload['error'] ) {
|
| 1924 |
+
return new WP_Error( 'upload_dir_error', $upload['error'] );
|
| 1925 |
}
|
| 1926 |
|
| 1927 |
// fetch the remote url and write it to the placeholder file
|
| 1941 |
// make sure the fetch was successful
|
| 1942 |
if ( $code !== 200 ) {
|
| 1943 |
unlink( $upload['file'] );
|
| 1944 |
+
return new WP_Error(
|
| 1945 |
'import_file_error',
|
| 1946 |
sprintf(
|
| 1947 |
__( 'Remote server returned %1$d %2$s for %3$s', 'wordpress-importer' ),
|
| 1961 |
//
|
| 1962 |
// if ( isset( $headers['content-length'] ) && $filesize !== (int) $headers['content-length'] ) {
|
| 1963 |
// unlink( $upload['file'] );
|
| 1964 |
+
// return new WP_Error( 'import_file_error', __( 'Remote file is incorrect size', 'wordpress-importer' ) );
|
| 1965 |
// }
|
| 1966 |
|
| 1967 |
if ( 0 === $filesize ) {
|
| 1968 |
unlink( $upload['file'] );
|
| 1969 |
+
return new WP_Error( 'import_file_error', __( 'Zero size file downloaded', 'wordpress-importer' ) );
|
| 1970 |
}
|
| 1971 |
|
| 1972 |
$max_size = (int) $this->max_attachment_size();
|
| 1973 |
if ( ! empty( $max_size ) && $filesize > $max_size ) {
|
| 1974 |
unlink( $upload['file'] );
|
| 1975 |
$message = sprintf( __( 'Remote file is too large, limit is %s', 'wordpress-importer' ), size_format( $max_size ) );
|
| 1976 |
+
return new WP_Error( 'import_file_error', $message );
|
| 1977 |
}
|
| 1978 |
|
| 1979 |
return $upload;
|
| 2178 |
}
|
| 2179 |
|
| 2180 |
// Run the update
|
| 2181 |
+
$data['comment_ID'] = $comment_id;
|
| 2182 |
$result = wp_update_comment( wp_slash( $data ) );
|
| 2183 |
if ( empty( $result ) ) {
|
| 2184 |
$this->logger->warning( sprintf(
|
| 2203 |
* Top-level siblings without an explicit root parent, shall be identified
|
| 2204 |
* with the parent_slug: top
|
| 2205 |
* [we'll map parent_slug: top into parent 0]
|
| 2206 |
+
*
|
| 2207 |
+
* @param array $terms_to_be_remapped The terms to be remapped.
|
| 2208 |
*/
|
| 2209 |
protected function post_process_terms( $terms_to_be_remapped ) {
|
| 2210 |
$this->mapping['term_slug']['top'] = 0;
|
| 2229 |
continue;
|
| 2230 |
}
|
| 2231 |
|
|
|
|
| 2232 |
$parent_slug = get_term_meta( $term_id, '_wxr_import_parent', true );
|
| 2233 |
|
| 2234 |
if ( empty( $parent_slug ) ) {
|
| 2307 |
|
| 2308 |
// remap enclosure urls
|
| 2309 |
$query = $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'", $from_url, $to_url );
|
| 2310 |
+
$wpdb->query( $query );
|
| 2311 |
}
|
| 2312 |
}
|
| 2313 |
|
| 2365 |
/**
|
| 2366 |
* Added to http_request_timeout filter to force timeout at 60 seconds during import
|
| 2367 |
*
|
| 2368 |
+
* @param int $val Time in seconds.
|
| 2369 |
* @access protected
|
| 2370 |
* @return int 60
|
| 2371 |
*/
|
vendor/composer/autoload_psr4.php
CHANGED
|
@@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
| 6 |
$baseDir = dirname($vendorDir);
|
| 7 |
|
| 8 |
return array(
|
| 9 |
-
'ProteusThemes\\WPContentImporter2\\' => array($vendorDir . '/proteusthemes/wp-content-importer-v2/src'),
|
| 10 |
'OCDI\\' => array($baseDir . '/inc'),
|
|
|
|
| 11 |
);
|
| 6 |
$baseDir = dirname($vendorDir);
|
| 7 |
|
| 8 |
return array(
|
|
|
|
| 9 |
'OCDI\\' => array($baseDir . '/inc'),
|
| 10 |
+
'AwesomeMotive\\WPContentImporter2\\' => array($vendorDir . '/awesomemotive/wp-content-importer-v2/src'),
|
| 11 |
);
|
vendor/composer/autoload_real.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
// autoload_real.php @generated by Composer
|
| 4 |
|
| 5 |
-
class
|
| 6 |
{
|
| 7 |
private static $loader;
|
| 8 |
|
|
@@ -13,21 +13,24 @@ class ComposerAutoloaderInit1dc3b7695346d0ca54da2c4b66963a38
|
|
| 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('
|
| 23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
| 24 |
-
spl_autoload_unregister(array('
|
| 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\
|
| 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 ComposerAutoloaderInitef3a658a88d521398d72929dc54fa111
|
| 6 |
{
|
| 7 |
private static $loader;
|
| 8 |
|
| 13 |
}
|
| 14 |
}
|
| 15 |
|
| 16 |
+
/**
|
| 17 |
+
* @return \Composer\Autoload\ClassLoader
|
| 18 |
+
*/
|
| 19 |
public static function getLoader()
|
| 20 |
{
|
| 21 |
if (null !== self::$loader) {
|
| 22 |
return self::$loader;
|
| 23 |
}
|
| 24 |
|
| 25 |
+
spl_autoload_register(array('ComposerAutoloaderInitef3a658a88d521398d72929dc54fa111', 'loadClassLoader'), true, true);
|
| 26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
| 27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitef3a658a88d521398d72929dc54fa111', 'loadClassLoader'));
|
| 28 |
|
| 29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
| 30 |
if ($useStaticLoader) {
|
| 31 |
require_once __DIR__ . '/autoload_static.php';
|
| 32 |
|
| 33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitef3a658a88d521398d72929dc54fa111::getInitializer($loader));
|
| 34 |
} else {
|
| 35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
| 36 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
|
@@ -4,35 +4,35 @@
|
|
| 4 |
|
| 5 |
namespace Composer\Autoload;
|
| 6 |
|
| 7 |
-
class
|
| 8 |
{
|
| 9 |
public static $prefixLengthsPsr4 = array (
|
| 10 |
-
'P' =>
|
| 11 |
-
array (
|
| 12 |
-
'ProteusThemes\\WPContentImporter2\\' => 33,
|
| 13 |
-
),
|
| 14 |
'O' =>
|
| 15 |
array (
|
| 16 |
'OCDI\\' => 5,
|
| 17 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
);
|
| 19 |
|
| 20 |
public static $prefixDirsPsr4 = array (
|
| 21 |
-
'ProteusThemes\\WPContentImporter2\\' =>
|
| 22 |
-
array (
|
| 23 |
-
0 => __DIR__ . '/..' . '/proteusthemes/wp-content-importer-v2/src',
|
| 24 |
-
),
|
| 25 |
'OCDI\\' =>
|
| 26 |
array (
|
| 27 |
0 => __DIR__ . '/../..' . '/inc',
|
| 28 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
);
|
| 30 |
|
| 31 |
public static function getInitializer(ClassLoader $loader)
|
| 32 |
{
|
| 33 |
return \Closure::bind(function () use ($loader) {
|
| 34 |
-
$loader->prefixLengthsPsr4 =
|
| 35 |
-
$loader->prefixDirsPsr4 =
|
| 36 |
|
| 37 |
}, null, ClassLoader::class);
|
| 38 |
}
|
| 4 |
|
| 5 |
namespace Composer\Autoload;
|
| 6 |
|
| 7 |
+
class ComposerStaticInitef3a658a88d521398d72929dc54fa111
|
| 8 |
{
|
| 9 |
public static $prefixLengthsPsr4 = array (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
'O' =>
|
| 11 |
array (
|
| 12 |
'OCDI\\' => 5,
|
| 13 |
),
|
| 14 |
+
'A' =>
|
| 15 |
+
array (
|
| 16 |
+
'AwesomeMotive\\WPContentImporter2\\' => 33,
|
| 17 |
+
),
|
| 18 |
);
|
| 19 |
|
| 20 |
public static $prefixDirsPsr4 = array (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
'OCDI\\' =>
|
| 22 |
array (
|
| 23 |
0 => __DIR__ . '/../..' . '/inc',
|
| 24 |
),
|
| 25 |
+
'AwesomeMotive\\WPContentImporter2\\' =>
|
| 26 |
+
array (
|
| 27 |
+
0 => __DIR__ . '/..' . '/awesomemotive/wp-content-importer-v2/src',
|
| 28 |
+
),
|
| 29 |
);
|
| 30 |
|
| 31 |
public static function getInitializer(ClassLoader $loader)
|
| 32 |
{
|
| 33 |
return \Closure::bind(function () use ($loader) {
|
| 34 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitef3a658a88d521398d72929dc54fa111::$prefixLengthsPsr4;
|
| 35 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitef3a658a88d521398d72929dc54fa111::$prefixDirsPsr4;
|
| 36 |
|
| 37 |
}, null, ClassLoader::class);
|
| 38 |
}
|
vendor/composer/installed.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
| 1 |
[
|
| 2 |
{
|
| 3 |
-
"name": "
|
| 4 |
-
"version": "
|
| 5 |
-
"version_normalized": "0.
|
| 6 |
"source": {
|
| 7 |
"type": "git",
|
| 8 |
-
"url": "https://github.com/
|
| 9 |
-
"reference": "
|
| 10 |
},
|
| 11 |
"dist": {
|
| 12 |
"type": "zip",
|
| 13 |
-
"url": "https://api.github.com/repos/
|
| 14 |
-
"reference": "
|
| 15 |
"shasum": ""
|
| 16 |
},
|
| 17 |
-
"time": "
|
| 18 |
"type": "library",
|
| 19 |
-
"installation-source": "
|
| 20 |
"autoload": {
|
| 21 |
"psr-4": {
|
| 22 |
-
"
|
| 23 |
}
|
| 24 |
},
|
| 25 |
"license": [
|
|
@@ -27,21 +27,29 @@
|
|
| 27 |
],
|
| 28 |
"authors": [
|
| 29 |
{
|
| 30 |
-
"name": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"homepage": "https://github.com/humanmade/WordPress-Importer/graphs/contributors"
|
| 32 |
}
|
| 33 |
],
|
| 34 |
-
"description": "WP content importer
|
| 35 |
"keywords": [
|
|
|
|
| 36 |
"content",
|
| 37 |
"import",
|
| 38 |
-
"proteusthemes",
|
| 39 |
"theme",
|
| 40 |
"wordpress",
|
| 41 |
"wp"
|
| 42 |
],
|
| 43 |
"support": {
|
| 44 |
-
"source": "https://github.com/
|
| 45 |
}
|
| 46 |
}
|
| 47 |
]
|
| 1 |
[
|
| 2 |
{
|
| 3 |
+
"name": "awesomemotive/wp-content-importer-v2",
|
| 4 |
+
"version": "v3.0.2",
|
| 5 |
+
"version_normalized": "3.0.2.0",
|
| 6 |
"source": {
|
| 7 |
"type": "git",
|
| 8 |
+
"url": "https://github.com/awesomemotive/WordPress-Importer.git",
|
| 9 |
+
"reference": "af60e6b933ed053f6e031118d57ea6bd04dbad12"
|
| 10 |
},
|
| 11 |
"dist": {
|
| 12 |
"type": "zip",
|
| 13 |
+
"url": "https://api.github.com/repos/awesomemotive/WordPress-Importer/zipball/af60e6b933ed053f6e031118d57ea6bd04dbad12",
|
| 14 |
+
"reference": "af60e6b933ed053f6e031118d57ea6bd04dbad12",
|
| 15 |
"shasum": ""
|
| 16 |
},
|
| 17 |
+
"time": "2020-07-21T06:59:04+00:00",
|
| 18 |
"type": "library",
|
| 19 |
+
"installation-source": "dist",
|
| 20 |
"autoload": {
|
| 21 |
"psr-4": {
|
| 22 |
+
"AwesomeMotive\\WPContentImporter2\\": "src/"
|
| 23 |
}
|
| 24 |
},
|
| 25 |
"license": [
|
| 27 |
],
|
| 28 |
"authors": [
|
| 29 |
{
|
| 30 |
+
"name": "Gregor Capuder",
|
| 31 |
+
"email": "capuderg@gmail.com"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Primoz Cigler",
|
| 35 |
+
"email": "primoz@proteusnet.com"
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"name": "Humanmade contributors",
|
| 39 |
"homepage": "https://github.com/humanmade/WordPress-Importer/graphs/contributors"
|
| 40 |
}
|
| 41 |
],
|
| 42 |
+
"description": "Improved WP content importer used in OCDI plugin.",
|
| 43 |
"keywords": [
|
| 44 |
+
"awesomemotive",
|
| 45 |
"content",
|
| 46 |
"import",
|
|
|
|
| 47 |
"theme",
|
| 48 |
"wordpress",
|
| 49 |
"wp"
|
| 50 |
],
|
| 51 |
"support": {
|
| 52 |
+
"source": "https://github.com/awesomemotive/WordPress-Importer/tree/v3.0.2"
|
| 53 |
}
|
| 54 |
}
|
| 55 |
]
|
vendor/proteusthemes/wp-content-importer-v2/README.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
| 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
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/plugin-page.php
CHANGED
|
@@ -66,9 +66,9 @@ do_action( 'pt-ocdi/plugin_page_header' );
|
|
| 66 |
|
| 67 |
<?php if ( ! empty( $this->import_files ) ) : ?>
|
| 68 |
<?php if ( empty( $_GET['import-mode'] ) || 'manual' !== $_GET['import-mode'] ) : ?>
|
| 69 |
-
<a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->plugin_page_setup['menu_slug'], 'import-mode' => 'manual' ),
|
| 70 |
<?php else : ?>
|
| 71 |
-
<a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->plugin_page_setup['menu_slug'] ),
|
| 72 |
<?php endif; ?>
|
| 73 |
<?php endif; ?>
|
| 74 |
|
| 66 |
|
| 67 |
<?php if ( ! empty( $this->import_files ) ) : ?>
|
| 68 |
<?php if ( empty( $_GET['import-mode'] ) || 'manual' !== $_GET['import-mode'] ) : ?>
|
| 69 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->plugin_page_setup['menu_slug'], 'import-mode' => 'manual' ), menu_page_url( $this->plugin_page_setup['parent_slug'], false ) ) ); ?>" class="ocdi__import-mode-switch"><?php esc_html_e( 'Switch to manual import!', 'pt-ocdi' ); ?></a>
|
| 70 |
<?php else : ?>
|
| 71 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->plugin_page_setup['menu_slug'] ), menu_page_url( $this->plugin_page_setup['parent_slug'], false ) ) ); ?>" class="ocdi__import-mode-switch"><?php esc_html_e( 'Switch back to theme predefined imports!', 'pt-ocdi' ); ?></a>
|
| 72 |
<?php endif; ?>
|
| 73 |
<?php endif; ?>
|
| 74 |
|
