forked from humanmade/WordPress-Importer
-
Notifications
You must be signed in to change notification settings - Fork 5
/
plugin.php
54 lines (47 loc) · 1.95 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
Plugin Name: WordPress Importer v2
Plugin URI: https://github.com/pbiron/wordpress-importer-v2
Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
Author: wordpressdotorg, rmccue, Paul V. Biron/Sparrow Hawk Computing
Author URI: http://wordpress.org/
Version: 2.1
Text Domain: wordpress-importer
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
GitHub Plugin URI: https://github.com/pbiron/wordpress-importer-v2
*/
/*
* @todo UI should inform user of the custom taxonomies of terms to be imported
*/
if ( ! class_exists( 'WP_Importer' ) ) {
defined( 'WP_LOAD_IMPORTERS' ) || define( 'WP_LOAD_IMPORTERS', true );
require ABSPATH . '/wp-admin/includes/class-wp-importer.php';
}
require dirname( __FILE__ ) . '/class-logger.php';
require dirname( __FILE__ ) . '/class-logger-cli.php';
require dirname( __FILE__ ) . '/class-logger-html.php';
require dirname( __FILE__ ) . '/class-logger-serversentevents.php';
require dirname( __FILE__ ) . '/class-wxr-importer.php';
require dirname( __FILE__ ) . '/class-wxr-import-info.php';
require dirname( __FILE__ ) . '/class-wxr-import-ui.php';
if ( defined( 'WP_CLI' ) ) {
require __DIR__ . '/class-command.php';
WP_CLI::add_command( 'wxr-importer', 'WXR_Import_Command' );
}
function wpimportv2_init() {
/**
* WordPress Importer object for registering the import callback
* @global WP_Import $wp_import
*/
$GLOBALS['wxr_importer'] = new WXR_Import_UI();
register_importer(
'wordpress-v2',
'WordPress (v2)',
__( 'Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export (WXR) file.', 'wordpress-importer' ),
array( $GLOBALS['wxr_importer'], 'dispatch' )
);
add_action( 'load-importer-wordpress-v2', array( $GLOBALS['wxr_importer'], 'on_load' ) );
add_action( 'wp_ajax_wxr-import', array( $GLOBALS['wxr_importer'], 'stream_import' ) );
}
add_action( 'admin_init', 'wpimportv2_init' );