PluginProbe
Polylang / 3.8.11
Polylang v3.8.11
3.8.11 3.8.10 3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 All 235 releases
polylang / src / integrations / wp-importer / wordpress-importer.php

wordpress-importer.php in Polylang 3.8.11, at src/integrations/wp-importer/wordpress-importer.php

47 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 */
5
6 /**
7 * Manages the compatibility with WordPress Importer.
8 *
9 * @since 2.8
10 */
11 class PLL_WordPress_Importer {
12
13 /**
14 * Setups filters.
15 *
16 * @since 2.8
17 */
18 public function __construct() {
19 add_action( 'init', array( $this, 'maybe_wordpress_importer' ) );
20 }
21
22 /**
23 * If WordPress Importer is active, replace the wordpress_importer_init function.
24 *
25 * @since 1.2
26 */
27 public function maybe_wordpress_importer() {
28 if ( defined( 'WP_LOAD_IMPORTERS' ) && class_exists( 'WP_Import' ) ) {
29 remove_action( 'admin_init', 'wordpress_importer_init' );
30 add_action( 'admin_init', array( $this, 'wordpress_importer_init' ) );
31 }
32 }
33
34 /**
35 * Loads our child class PLL_WP_Import instead of WP_Import.
36 *
37 * @since 1.2
38 */
39 public function wordpress_importer_init() {
40 $class = new ReflectionClass( 'WP_Import' );
41 load_plugin_textdomain( 'wordpress-importer', false, basename( dirname( $class->getFileName() ) ) . '/languages' );
42
43 $GLOBALS['wp_import'] = new PLL_WP_Import();
44 register_importer( 'wordpress', 'WordPress', __( 'Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.', 'polylang' ), array( $GLOBALS['wp_import'], 'dispatch' ) ); // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText
45 }
46 }
47