function handle_upload()
{
$file = wp_import_handle_upload();
if (isset($file['error'])) {
echo '<p><strong>' . __('Sorry, there has been an error.', 'wordpress-importer') . '</strong><br />';
echo esc_html($file['error']) . '</p>';
return false;
} else {
if (!file_exists($file['file'])) {
echo '<p><strong>' . __('Sorry, there has been an error.', 'wordpress-importer') . '</strong><br />';
printf(__('The export file could not be found at <code>%s</code>. It is likely that this was caused by a permissions problem.', 'wordpress-importer'), esc_html($file['file']));
echo '</p>';
return false;
}
}
$this->id = (int) $file['id'];
$import_data = $this->parse($file['file']);
if (is_wp_error($import_data)) {
echo '<p><strong>' . __('Sorry, there has been an error.', 'wordpress-importer') . '</strong><br />';
echo esc_html($import_data->get_error_message()) . '</p>';
return false;
}
$this->version = $import_data['version'];
if ($this->version > $this->max_wxr_version) {
echo '<div class="error"><p><strong>';
printf(__('This WXR file (version %s) may not be supported by this version of the importer. Please consider updating.', 'wordpress-importer'), esc_html($import_data['version']));
echo '</strong></p></div>';
}
$this->get_authors_from_import($import_data);
return true;
}