PHP 8.1.33
Preview: import.php Size: 6.46 KB
/home/jambtst2015/public_html/www.securiskbrokers.com/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: 0 × Files: 107

Name Size Perms Modified Actions
7.89 KB lrw-r--r-- 2024-10-21 03:25:16
Edit Download
3.54 KB lrw-r--r-- 2023-07-11 09:03:24
Edit Download
148.07 KB lrw-r--r-- 2024-09-18 02:41:14
Edit Download
11.34 KB lrw-r--r-- 2023-05-03 14:03:22
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.11 KB lrw-r--r-- 2024-09-06 18:36:20
Edit Download
47.91 KB lrw-r--r-- 2024-09-06 18:36:20
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.66 KB lrw-r--r-- 2024-02-12 17:07:10
Edit Download
2.80 KB lrw-r--r-- 2024-05-02 21:20:10
Edit Download
15.20 KB lrw-r--r-- 2024-04-30 12:39:08
Edit Download
192.09 KB lrw-r--r-- 2024-03-31 09:52: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.70 KB lrw-r--r-- 2024-10-03 04:25:16
Edit Download
12.44 KB lrw-r--r-- 2024-10-03 04:25:16
Edit Download
4.08 KB lrw-r--r-- 2024-02-27 01:35:08
Edit Download
26.08 KB lrw-r--r-- 2024-10-03 04:25:16
Edit Download
4.97 KB lrw-r--r-- 2024-08-14 03:37:16
Edit Download
5.50 KB lrw-r--r-- 2023-09-08 13:32:24
Edit Download
13.85 KB lrw-r--r-- 2024-10-21 23:55: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
59.70 KB lrw-r--r-- 2024-10-03 04:25:16
Edit Download
32.15 KB lrw-r--r-- 2024-08-13 01:28:14
Edit Download
18.33 KB lrw-r--r-- 2023-09-12 19:23:18
Edit Download
63.76 KB lrw-r--r-- 2024-10-28 01:59:12
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.56 KB lrw-r--r-- 2024-02-17 02:47:12
Edit Download
18.05 KB lrw-r--r-- 2024-02-17 02:47:12
Edit Download
22.76 KB lrw-r--r-- 2024-02-17 02:47:12
Edit Download
7.29 KB lrw-r--r-- 2023-08-14 13:59:20
Edit Download
4.47 KB lrw-r--r-- 2023-06-14 16:57:20
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.63 KB lrw-r--r-- 2024-09-30 22:24:14
Edit Download
25.03 KB lrw-r--r-- 2024-07-17 19:43:16
Edit Download
21.51 KB lrw-r--r-- 2024-07-17 19:43:16
Edit Download
27.67 KB lrw-r--r-- 2024-07-17 19:43:16
Edit Download
14.93 KB lrw-r--r-- 2024-07-17 19:43:16
Edit Download
24.21 KB lrw-r--r-- 2024-07-17 19:43:16
Edit Download
56.43 KB lrw-r--r-- 2024-09-03 22:19:14
Edit Download
1.42 KB lrw-r--r-- 2022-10-04 07:47:16
Edit Download
62.45 KB lrw-r--r-- 2024-09-09 18:37:18
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
32.01 KB lrw-r--r-- 2024-09-03 22:19:14
Edit Download
13.65 KB lrw-r--r-- 2023-09-22 23:58:16
Edit Download
36.45 KB lrw-r--r-- 2024-06-15 16:34:14
Edit Download
13.24 KB lrw-r--r-- 2024-08-22 02:23:16
Edit Download
119.50 KB lrw-r--r-- 2024-10-03 04:25:16
Edit Download
6.26 KB lrw-r--r-- 2024-03-03 01:15:14
Edit Download
20.69 KB lrw-r--r-- 2024-06-15 16:34:14
Edit Download
15.42 KB lrw-r--r-- 2024-07-17 19:43:16
Edit Download
10.10 KB lrw-r--r-- 2024-07-17 19:43:16
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.58 KB lrw-r--r-- 2024-10-19 03:37:20
Edit Download
18.61 KB lrw-r--r-- 2024-01-10 16:57:16
Edit Download
5.98 KB lrw-r--r-- 2022-07-21 02:15:10
Edit Download
20.06 KB lrw-r--r-- 2022-09-20 03:24:12
Edit Download
5.73 KB lrw-r--r-- 2024-07-27 04:27:16
Edit Download
68.08 KB lrw-r--r-- 2024-10-03 04:25:16
Edit Download
40.80 KB lrw-r--r-- 2024-01-10 16:57:16
Edit Download
1.44 KB lrw-r--r-- 2021-12-07 17:20:02
Edit Download
307 B lrw-r--r-- 2025-10-17 03:02:14
Edit Download
24.97 KB lrw-r--r-- 2024-04-16 00:03:10
Edit Download
95.19 KB lrw-r--r-- 2024-09-03 22:19:14
Edit Download
42.82 KB lrw-r--r-- 2024-10-10 03:32:22
Edit Download
42.40 KB lrw-r--r-- 2024-11-11 20:46:16
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.08 KB lrw-r--r-- 2024-09-30 09:19:16
Edit Download
9.39 KB lrw-r--r-- 2023-11-06 14:27:24
Edit Download
64.54 KB lrw-r--r-- 2024-07-21 22:58:16
Edit Download
45.38 KB lrw-r--r-- 2024-09-03 22:19:14
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.16 KB lrw-r--r-- 2024-05-11 18:47:06
Edit Download
47.76 KB lrw-r--r-- 2024-09-03 22:19:14
Edit Download
26.35 KB lrw-r--r-- 2024-05-10 03:09:14
Edit Download
1.12 KB lrw-r--r-- 2023-09-21 05:27:26
Edit Download
4.15 KB lrw-r--r-- 2024-02-27 01:18:10
Edit Download
38.55 KB lrw-r--r-- 2024-08-09 04:18:16
Edit Download
90.75 KB lrw-r--r-- 2024-09-03 22:19:14
Edit Download
79.77 KB lrw-r--r-- 2024-09-04 02:43:14
Edit Download
32.68 KB lrw-r--r-- 2023-06-22 18:36:26
Edit Download
16.11 KB lrw-r--r-- 2024-10-29 01:26:18
Edit Download
41.66 KB lrw-r--r-- 2024-08-24 03:17:14
Edit Download
6.23 KB lrw-r--r-- 2024-06-15 16:34:14
Edit Download
8.23 KB lrw-r--r-- 2023-03-10 12:04:20
Edit Download
96.31 KB lrw-r--r-- 2024-10-13 23:09:12
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
67.71 KB lrw-r--r-- 2024-11-12 00:21:18
Edit Download
33.62 KB lrw-r--r-- 2024-07-27 04:27:16
Edit Download
111.22 KB lrw-r--r-- 2024-10-04 17:19:18
Edit Download
22.96 KB lrw-r--r-- 2023-11-17 18:29:26
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).