class-fl-builder-import.php
1.3 KB
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
<?php
/**
* The WordPress importer plugin has a few issues that break
* serialized data in certain cases. This class overrides the
* WordPress importer with our own patched version that fixes
* these issues.
*
* @since 1.8
*/
final class FLBuilderImport {
/**
* @since 1.8
* @return void
*/
static public function init()
{
if ( ! defined( 'WP_LOAD_IMPORTERS' ) || ! class_exists( 'WP_Import' ) || ! class_exists( 'WXR_Parser_Regex' ) ) {
return;
}
if ( defined( 'FL_BUILDER_IMPORTER_FIX' ) && ! FL_BUILDER_IMPORTER_FIX ) {
return;
}
require_once FL_BUILDER_DIR . '/classes/class-fl-builder-importer.php';
// Remove the WordPress importer.
remove_action( 'admin_init', 'wordpress_importer_init' );
// Add our importer.
add_action( 'admin_init', 'FLBuilderImport::load' );
}
/**
* @since 1.8
* @return void
*/
static public function load()
{
load_plugin_textdomain( 'wordpress-importer', false, 'wordpress-importer/languages' );
$GLOBALS['wp_import'] = new FLBuilderImporter();
register_importer( 'wordpress', 'WordPress', __('Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.', 'wordpress-importer'), array( $GLOBALS['wp_import'], 'dispatch' ) );
}
}
add_action( 'plugins_loaded', 'FLBuilderImport::init' );