summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/wordpress-importer/wordpress-importer.php')
-rw-r--r--plugins/wordpress-importer/wordpress-importer.php30
1 files changed, 20 insertions, 10 deletions
diff --git a/plugins/wordpress-importer/wordpress-importer.php b/plugins/wordpress-importer/wordpress-importer.php
index 31b91b62..97376f0a 100644
--- a/plugins/wordpress-importer/wordpress-importer.php
+++ b/plugins/wordpress-importer/wordpress-importer.php
@@ -1,11 +1,11 @@
<?php
/*
Plugin Name: WordPress Importer
-Plugin URI: http://wordpress.org/extend/plugins/wordpress-importer/
+Plugin URI: https://wordpress.org/plugins/wordpress-importer/
Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
Author: wordpressdotorg
-Author URI: http://wordpress.org/
-Version: 0.6.3
+Author URI: https://wordpress.org/
+Version: 0.6.4
Text Domain: wordpress-importer
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@@ -786,6 +786,7 @@ class WP_Import extends WP_Importer {
if ( ! $post_exists || ! comment_exists( $comment['comment_author'], $comment['comment_date'] ) ) {
if ( isset( $inserted_comments[$comment['comment_parent']] ) )
$comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
+ $comment = wp_slash( $comment );
$comment = wp_filter_comment( $comment );
$inserted_comments[$key] = wp_insert_comment( $comment );
do_action( 'wp_import_insert_comment', $inserted_comments[$key], $comment, $comment_post_ID, $post );
@@ -881,7 +882,7 @@ class WP_Import extends WP_Importer {
}
foreach ( $item['postmeta'] as $meta )
- $$meta['key'] = $meta['value'];
+ ${$meta['key']} = $meta['value'];
if ( 'taxonomy' == $_menu_item_type && isset( $this->processed_terms[intval($_menu_item_object_id)] ) ) {
$_menu_item_object_id = $this->processed_terms[intval($_menu_item_object_id)];
@@ -988,7 +989,13 @@ class WP_Import extends WP_Importer {
return new WP_Error( 'upload_dir_error', $upload['error'] );
// fetch the remote url and write it to the placeholder file
- $headers = wp_get_http( $url, $upload['file'] );
+ $remote_response = wp_safe_remote_get( $url, array(
+ 'timeout' => 300,
+ 'stream' => true,
+ 'filename' => $upload['file'],
+ ) );
+
+ $headers = wp_remote_retrieve_headers( $remote_response );
// request failed
if ( ! $headers ) {
@@ -996,10 +1003,12 @@ class WP_Import extends WP_Importer {
return new WP_Error( 'import_file_error', __('Remote server did not respond', 'wordpress-importer') );
}
+ $remote_response_code = wp_remote_retrieve_response_code( $remote_response );
+
// make sure the fetch was successful
- if ( $headers['response'] != '200' ) {
+ if ( $remote_response_code != '200' ) {
@unlink( $upload['file'] );
- return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($headers['response']), get_status_header_desc($headers['response']) ) );
+ return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($remote_response_code), get_status_header_desc($remote_response_code) ) );
}
$filesize = filesize( $upload['file'] );
@@ -1048,8 +1057,10 @@ class WP_Import extends WP_Importer {
if ( isset( $this->processed_posts[$parent_id] ) )
$local_parent_id = $this->processed_posts[$parent_id];
- if ( $local_child_id && $local_parent_id )
+ if ( $local_child_id && $local_parent_id ) {
$wpdb->update( $wpdb->posts, array( 'post_parent' => $local_parent_id ), array( 'ID' => $local_child_id ), '%d', '%d' );
+ clean_post_cache( $local_child_id );
+ }
}
// all other posts/terms are imported, retry menu items with missing associated object
@@ -1115,7 +1126,6 @@ class WP_Import extends WP_Importer {
// Display import page title
function header() {
echo '<div class="wrap">';
- screen_icon();
echo '<h2>' . __( 'Import WordPress', 'wordpress-importer' ) . '</h2>';
$updates = get_plugin_updates();
@@ -1206,7 +1216,7 @@ class WP_Import extends WP_Importer {
} // class_exists( 'WP_Importer' )
function wordpress_importer_init() {
- load_plugin_textdomain( 'wordpress-importer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
+ load_plugin_textdomain( 'wordpress-importer' );
/**
* WordPress Importer object for registering the import callback