| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
/* |
| 6 |
* @wordpress-plugin |
| 7 |
* Plugin Name: WordPress Importer |
| 8 |
* Plugin URI: https://wordpress.org/plugins/wordpress-importer/ |
| 9 |
* Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file. |
| 10 |
* Author: wordpressdotorg |
| 11 |
* Author URI: https://wordpress.org/ |
| 12 |
* Version: 0.8.4 |
| 13 |
* Requires at least: 5.2 |
| 14 |
* Requires PHP: 5.6 |
| 15 |
* Text Domain: wordpress-importer |
| 16 |
* License: GPLv2 or later |
| 17 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 18 |
*/ |
| 19 |
|
| 20 |
if ( ! defined( 'WP_LOAD_IMPORTERS' ) ) { |
| 21 |
return; |
| 22 |
} |
| 23 |
|
| 24 |
/** Display verbose errors */ |
| 25 |
if ( ! defined( 'IMPORT_DEBUG' ) ) { |
| 26 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- WordPress Importer compatibility constant. |
| 27 |
define( 'IMPORT_DEBUG', WP_DEBUG ); |
| 28 |
} |
| 29 |
|
| 30 |
/** WordPress Import Administration API */ |
| 31 |
require_once ABSPATH . 'wp-admin/includes/import.php'; |
| 32 |
|
| 33 |
if ( ! class_exists( 'WP_Importer' ) ) { |
| 34 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- WordPress Importer API compatibility |
| 35 |
$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; |
| 36 |
if ( file_exists( $class_wp_importer ) ) { |
| 37 |
require $class_wp_importer; |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
/** Functions missing in older WordPress versions. */ |
| 42 |
require_once __DIR__ . '/compat.php'; |
| 43 |
|
| 44 |
/** Solace_Extra_WXR_Parser class */ |
| 45 |
require_once __DIR__ . '/parsers/class-wxr-parser.php'; |
| 46 |
|
| 47 |
/** Solace_Extra_WXR_Parser_SimpleXML class */ |
| 48 |
require_once __DIR__ . '/parsers/class-wxr-parser-simplexml.php'; |
| 49 |
|
| 50 |
/** Solace_Extra_WXR_Parser_XML class */ |
| 51 |
require_once __DIR__ . '/parsers/class-wxr-parser-xml.php'; |
| 52 |
|
| 53 |
/** Solace_Extra_WXR_Parser_Regex class */ |
| 54 |
require_once __DIR__ . '/parsers/class-wxr-parser-regex.php'; |
| 55 |
|
| 56 |
/** Solace_Extra_WP_Import class */ |
| 57 |
require_once __DIR__ . '/class-wp-import.php'; |
| 58 |
|
| 59 |
function solace_extra_wordpress_importer_init() { |
| 60 |
|
| 61 |
/** |
| 62 |
* WordPress Importer object for registering the import callback |
| 63 |
* @global Solace_Extra_WP_Import $wp_import |
| 64 |
*/ |
| 65 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- WordPress Importer API compatibility |
| 66 |
$GLOBALS['wp_import'] = new Solace_Extra_WP_Import(); |
| 67 |
// phpcs:ignore WordPress.WP.CapitalPDangit |
| 68 |
register_importer( 'wordpress', 'WordPress', __( 'Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.', 'solace-extra' ), array( $GLOBALS['wp_import'], 'dispatch' ) ); |
| 69 |
} |
| 70 |
add_action( 'admin_init', 'solace_extra_wordpress_importer_init' ); |
| 71 |
|