PHP 8.2.30
Preview: import.php Size: 6.46 KB
/proc/thread-self/root/home/byroehnu/kingslandgroupofschools.com.ng/wp-admin/includes/import.php

<?php
/**
 * WordPress Administration Importer API.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Retrieves the list of importers.
 *
 * @since 2.0.0
 *
 * @global array $wp_importers
 * @return array
 */
function get_importers() {
	global $wp_importers;
	if ( is_array( $wp_importers ) ) {
		uasort( $wp_importers, '_usort_by_first_member' );
	}
	return $wp_importers;
}

/**
 * Sorts a multidimensional array by first member of each top level member.
 *
 * Used by uasort() as a callback, should not be used directly.
 *
 * @since 2.9.0
 * @access private
 *
 * @param array $a
 * @param array $b
 * @return int
 */
function _usort_by_first_member( $a, $b ) {
	return strnatcasecmp( $a[0], $b[0] );
}

/**
 * Registers importer for WordPress.
 *
 * @since 2.0.0
 *
 * @global array $wp_importers
 *
 * @param string   $id          Importer tag. Used to uniquely identify importer.
 * @param string   $name        Importer name and title.
 * @param string   $description Importer description.
 * @param callable $callback    Callback to run.
 * @return void|WP_Error Void on success. WP_Error when $callback is WP_Error.
 */
function register_importer( $id, $name, $description, $callback ) {
	global $wp_importers;
	if ( is_wp_error( $callback ) ) {
		return $callback;
	}
	$wp_importers[ $id ] = array( $name, $description, $callback );
}

/**
 * Cleanup importer.
 *
 * Removes attachment based on ID.
 *
 * @since 2.0.0
 *
 * @param string $id Importer ID.
 */
function wp_import_cleanup( $id ) {
	wp_delete_attachment( $id );
}

/**
 * Handles importer uploading and adds attachment.
 *
 * @since 2.0.0
 *
 * @return array Uploaded file's details on success, error message on failure.
 */
function wp_import_handle_upload() {
	if ( ! isset( $_FILES['import'] ) ) {
		return array(
			'error' => sprintf(
				/* translators: 1: php.ini, 2: post_max_size, 3: upload_max_filesize */
				__( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ),
				'php.ini',
				'post_max_size',
				'upload_max_filesize'
			),
		);
	}

	$overrides                 = array(
		'test_form' => false,
		'test_type' => false,
	);
	$_FILES['import']['name'] .= '.txt';
	$upload                    = wp_handle_upload( $_FILES['import'], $overrides );

	if ( isset( $upload['error'] ) ) {
		return $upload;
	}

	// Construct the attachment array.
	$attachment = array(
		'post_title'     => wp_basename( $upload['file'] ),
		'post_content'   => $upload['url'],
		'post_mime_type' => $upload['type'],
		'guid'           => $upload['url'],
		'context'        => 'import',
		'post_status'    => 'private',
	);

	// Save the data.
	$id = wp_insert_attachment( $attachment, $upload['file'] );

	/*
	 * Schedule a cleanup for one day from now in case of failed
	 * import or missing wp_import_cleanup() call.
	 */
	wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) );

	return array(
		'file' => $upload['file'],
		'id'   => $id,
	);
}

/**
 * Returns a list from WordPress.org of popular importer plugins.
 *
 * @since 3.5.0
 *
 * @return array Importers with metadata for each.
 */
function wp_get_popular_importers() {
	$locale            = get_user_locale();
	$cache_key         = 'popular_importers_' . md5( $locale . wp_get_wp_version() );
	$popular_importers = get_site_transient( $cache_key );

	if ( ! $popular_importers ) {
		$url     = add_query_arg(
			array(
				'locale'  => $locale,
				'version' => wp_get_wp_version(),
			),
			'http://api.wordpress.org/core/importers/1.1/'
		);
		$options = array( 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ) );

		if ( wp_http_supports( array( 'ssl' ) ) ) {
			$url = set_url_scheme( $url, 'https' );
		}

		$response          = wp_remote_get( $url, $options );
		$popular_importers = json_decode( wp_remote_retrieve_body( $response ), true );

		if ( is_array( $popular_importers ) ) {
			set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS );
		} else {
			$popular_importers = false;
		}
	}

	if ( is_array( $popular_importers ) ) {
		// If the data was received as translated, return it as-is.
		if ( $popular_importers['translated'] ) {
			return $popular_importers['importers'];
		}

		foreach ( $popular_importers['importers'] as &$importer ) {
			// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
			$importer['description'] = translate( $importer['description'] );
			if ( 'WordPress' !== $importer['name'] ) {
				// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
				$importer['name'] = translate( $importer['name'] );
			}
		}
		return $popular_importers['importers'];
	}

	return array(
		// slug => name, description, plugin slug, and register_importer() slug.
		'blogger'     => array(
			'name'        => __( 'Blogger' ),
			'description' => __( 'Import posts, comments, and users from a Blogger blog.' ),
			'plugin-slug' => 'blogger-importer',
			'importer-id' => 'blogger',
		),
		'wpcat2tag'   => array(
			'name'        => __( 'Categories and Tags Converter' ),
			'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ),
			'plugin-slug' => 'wpcat2tag-importer',
			'importer-id' => 'wp-cat2tag',
		),
		'livejournal' => array(
			'name'        => __( 'LiveJournal' ),
			'description' => __( 'Import posts from LiveJournal using their API.' ),
			'plugin-slug' => 'livejournal-importer',
			'importer-id' => 'livejournal',
		),
		'movabletype' => array(
			'name'        => __( 'Movable Type and TypePad' ),
			'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ),
			'plugin-slug' => 'movabletype-importer',
			'importer-id' => 'mt',
		),
		'rss'         => array(
			'name'        => __( 'RSS' ),
			'description' => __( 'Import posts from an RSS feed.' ),
			'plugin-slug' => 'rss-importer',
			'importer-id' => 'rss',
		),
		'tumblr'      => array(
			'name'        => __( 'Tumblr' ),
			'description' => __( 'Import posts &amp; media from Tumblr using their API.' ),
			'plugin-slug' => 'tumblr-importer',
			'importer-id' => 'tumblr',
		),
		'wordpress'   => array(
			'name'        => 'WordPress',
			'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ),
			'plugin-slug' => 'wordpress-importer',
			'importer-id' => 'wordpress',
		),
	);
}

Directory Contents

Dirs: 1 × Files: 107

Name Size Perms Modified Actions
colors DIR
- drwxr-xr-x 2026-03-16 08:30:50
Edit Download
7.85 KB lrw-r--r-- 2025-10-21 17:46:24
Edit Download
3.54 KB lrw-r--r-- 2023-07-11 09:03:24
Edit Download
148.33 KB lrw-r--r-- 2025-08-15 15:01:30
Edit Download
11.45 KB lrw-r--r-- 2025-03-04 10:55:24
Edit Download
3.58 KB lrw-r--r-- 2023-06-22 18:36:26
Edit Download
2.53 KB lrw-r--r-- 2024-05-02 21:20:10
Edit Download
2.60 KB lrw-r--r-- 2024-05-02 21:20:10
Edit Download
6.59 KB lrw-r--r-- 2024-05-02 21:20:10
Edit Download
14.83 KB lrw-r--r-- 2024-10-06 03:25:12
Edit Download
21.18 KB lrw-r--r-- 2025-09-29 02:38:32
Edit Download
48.13 KB lrw-r--r-- 2025-10-18 17:26:30
Edit Download
4.07 KB lrw-r--r-- 2024-03-07 10:58:16
Edit Download
5.30 KB lrw-r--r-- 2019-11-01 18:57:02
Edit Download
8.28 KB lrw-r--r-- 2022-03-22 20:25:04
Edit Download
26.73 KB lrw-r--r-- 2025-02-20 13:42:28
Edit Download
2.80 KB lrw-r--r-- 2024-05-02 21:20:10
Edit Download
15.20 KB lrw-r--r-- 2025-06-03 20:51:34
Edit Download
192.08 KB lrw-r--r-- 2024-12-13 03:23:16
Edit Download
11.77 KB lrw-r--r-- 2024-10-03 04:25:16
Edit Download
3.20 KB lrw-r--r-- 2023-06-14 10:34:28
Edit Download
22.89 KB lrw-r--r-- 2025-10-21 03:37:34
Edit Download
12.77 KB lrw-r--r-- 2025-11-11 02:08:06
Edit Download
4.08 KB lrw-r--r-- 2024-02-27 01:35:08
Edit Download
26.27 KB lrw-r--r-- 2025-10-21 17:42:28
Edit Download
4.97 KB lrw-r--r-- 2024-08-14 03:37:16
Edit Download
5.57 KB lrw-r--r-- 2026-03-11 03:24:16
Edit Download
13.93 KB lrw-r--r-- 2026-03-11 03:24:16
Edit Download
4.09 KB lrw-r--r-- 2023-06-22 18:36:26
Edit Download
6.79 KB lrw-r--r-- 2024-02-17 02:47:12
Edit Download
60.45 KB lrw-r--r-- 2025-06-03 20:51:34
Edit Download
32.40 KB lrw-r--r-- 2026-02-04 03:20:36
Edit Download
18.24 KB lrw-r--r-- 2025-06-02 19:00:28
Edit Download
66.01 KB lrw-r--r-- 2025-06-05 12:16:28
Edit Download
23.84 KB lrw-r--r-- 2024-02-17 02:47:12
Edit Download
17.72 KB lrw-r--r-- 2024-02-17 02:47:12
Edit Download
22.71 KB lrw-r--r-- 2025-11-04 02:38:34
Edit Download
18.05 KB lrw-r--r-- 2025-06-03 20:51:34
Edit Download
22.76 KB lrw-r--r-- 2024-02-17 02:47:12
Edit Download
7.34 KB lrw-r--r-- 2025-03-25 22:36:26
Edit Download
4.51 KB lrw-r--r-- 2025-08-27 14:34:28
Edit Download
9.02 KB lrw-r--r-- 2024-07-17 19:43:16
Edit Download
1.46 KB lrw-r--r-- 2020-11-14 21:54:08
Edit Download
51.76 KB lrw-r--r-- 2025-08-27 14:34:28
Edit Download
25.29 KB lrw-r--r-- 2025-03-17 22:54:28
Edit Download
21.61 KB lrw-r--r-- 2025-06-27 19:09:32
Edit Download
27.77 KB lrw-r--r-- 2025-03-10 22:16:28
Edit Download
15.35 KB lrw-r--r-- 2025-02-27 05:09:24
Edit Download
24.54 KB lrw-r--r-- 2025-08-01 02:49:34
Edit Download
56.44 KB lrw-r--r-- 2025-09-09 00:58:38
Edit Download
1.42 KB lrw-r--r-- 2022-10-04 07:47:16
Edit Download
63.66 KB lrw-r--r-- 2025-07-25 19:17:22
Edit Download
5.43 KB lrw-r--r-- 2022-03-11 00:22:02
Edit Download
5.58 KB lrw-r--r-- 2023-09-08 13:32:24
Edit Download
31.90 KB lrw-r--r-- 2025-08-27 14:34:28
Edit Download
14.44 KB lrw-r--r-- 2025-10-03 01:48:36
Edit Download
36.47 KB lrw-r--r-- 2025-08-24 17:44:32
Edit Download
14.00 KB lrw-r--r-- 2024-11-04 20:25:18
Edit Download
121.89 KB lrw-r--r-- 2025-11-04 13:50:36
Edit Download
6.26 KB lrw-r--r-- 2024-03-03 01:15:14
Edit Download
20.73 KB lrw-r--r-- 2025-07-23 21:00:42
Edit Download
15.23 KB lrw-r--r-- 2025-01-22 02:49:22
Edit Download
10.14 KB lrw-r--r-- 2025-08-27 14:34:28
Edit Download
6.94 KB lrw-r--r-- 2024-05-02 21:20:10
Edit Download
1.44 KB lrw-r--r-- 2019-10-08 21:19:04
Edit Download
46.85 KB lrw-r--r-- 2025-07-06 20:42:36
Edit Download
18.61 KB lrw-r--r-- 2024-01-10 16:57:16
Edit Download
6.08 KB lrw-r--r-- 2025-10-31 22:57:30
Edit Download
20.06 KB lrw-r--r-- 2022-09-20 03:24:12
Edit Download
5.73 KB lrw-r--r-- 2024-12-19 08:44:24
Edit Download
68.18 KB lrw-r--r-- 2025-11-11 01:39:36
Edit Download
40.80 KB lrw-r--r-- 2025-07-19 15:52:32
Edit Download
1.44 KB lrw-r--r-- 2021-12-07 17:20:02
Edit Download
18.23 KB lrw-r--r-- 2026-01-31 01:38:42
Edit Download
25.26 KB lrw-r--r-- 2026-02-04 03:20:36
Edit Download
95.94 KB lrw-r--r-- 2026-03-12 03:20:02
Edit Download
43.12 KB lrw-r--r-- 2025-09-03 16:18:32
Edit Download
41.73 KB lrw-r--r-- 2025-11-25 19:08:30
Edit Download
6.46 KB lrw-r--r-- 2024-07-27 04:27:16
Edit Download
3.71 KB lrw-r--r-- 2022-10-04 07:47:16
Edit Download
116.31 KB lrw-r--r-- 2025-12-01 19:26:32
Edit Download
9.39 KB lrw-r--r-- 2023-11-06 14:27:24
Edit Download
64.34 KB lrw-r--r-- 2025-09-29 02:38:32
Edit Download
44.73 KB lrw-r--r-- 2025-09-29 02:38:32
Edit Download
1.27 KB lrw-r--r-- 2022-09-20 06:51:10
Edit Download
3.68 KB lrw-r--r-- 2022-09-20 06:51:10
Edit Download
33.53 KB lrw-r--r-- 2025-07-06 15:57:36
Edit Download
48.84 KB lrw-r--r-- 2025-10-21 00:31:34
Edit Download
26.35 KB lrw-r--r-- 2025-03-26 14:30:32
Edit Download
1.12 KB lrw-r--r-- 2023-09-21 05:27:26
Edit Download
4.19 KB lrw-r--r-- 2025-08-27 14:34:28
Edit Download
38.19 KB lrw-r--r-- 2026-02-04 03:20:36
Edit Download
91.33 KB lrw-r--r-- 2025-10-21 08:33:30
Edit Download
80.39 KB lrw-r--r-- 2025-09-02 20:50:32
Edit Download
32.67 KB lrw-r--r-- 2025-04-21 15:49:32
Edit Download
16.18 KB lrw-r--r-- 2025-08-17 01:53:28
Edit Download
44.46 KB lrw-r--r-- 2025-11-11 03:51:36
Edit Download
6.23 KB lrw-r--r-- 2024-06-15 16:34:14
Edit Download
8.23 KB lrw-r--r-- 2025-06-03 20:51:34
Edit Download
96.96 KB lrw-r--r-- 2025-11-18 23:16:32
Edit Download
6.83 KB lrw-r--r-- 2024-02-27 01:35:08
Edit Download
46.62 KB lrw-r--r-- 2024-07-27 04:27:16
Edit Download
10.82 KB lrw-r--r-- 2024-09-11 16:08:20
Edit Download
68.86 KB lrw-r--r-- 2026-03-12 03:20:02
Edit Download
33.63 KB lrw-r--r-- 2025-02-23 16:11:22
Edit Download
113.30 KB lrw-r--r-- 2025-10-21 08:33:30
Edit Download
22.98 KB lrw-r--r-- 2025-03-02 05:43:24
Edit Download
10.66 KB lrw-r--r-- 2023-09-09 13:28:26
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).