'; echo '
'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import the posts, comments, custom fields, and categories into this blog.').'
'; echo ''.__('Choose a WordPress WXR file to upload, then click Upload file and import.').'
'; wp_import_upload_form("admin.php?import=wordpress&step=1"); echo 'admins entries.'); ?>
allow_create_users() ) { echo ''.__('If a new user is created by WordPress, a password will be randomly generated. Manually change the user\'s details if necessary.')."
\n"; } $authors = $this->get_wp_authors(); echo ' '; } function users_form($n, $author) { if ( $this->allow_create_users() ) { printf(__('Create user %1$s or map to existing'), ''.__('Please upload a valid WXR (WordPress eXtended RSS) export file.').'
'; } } // fetch the user ID for a given author name, respecting the mapping preferences function checkauthor($author) { global $current_user; if ( !empty($this->author_ids[$author]) ) return $this->author_ids[$author]; // failsafe: map to the current user return $current_user->ID; } function process_categories() { global $wpdb; $cat_names = (array) get_terms('category', 'fields=names'); while ( $c = array_shift($this->categories) ) { $cat_name = trim($this->get_tag( $c, 'wp:cat_name' )); // If the category exists we leave it alone if ( in_array($cat_name, $cat_names) ) continue; $category_nicename = $this->get_tag( $c, 'wp:category_nicename' ); $posts_private = (int) $this->get_tag( $c, 'wp:posts_private' ); $links_private = (int) $this->get_tag( $c, 'wp:links_private' ); $parent = $this->get_tag( $c, 'wp:category_parent' ); if ( empty($parent) ) $category_parent = '0'; else $category_parent = category_exists($parent); $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name'); $cat_ID = wp_insert_category($catarr); } } function process_tags() { global $wpdb; $tag_names = (array) get_terms('post_tag', 'fields=names'); while ( $c = array_shift($this->tags) ) { $tag_name = trim($this->get_tag( $c, 'wp:tag_name' )); // If the category exists we leave it alone if ( in_array($tag_name, $tag_names) ) continue; $slug = $this->get_tag( $c, 'wp:tag_slug' ); $description = $this->get_tag( $c, 'wp:tag_description' ); $tagarr = compact('slug', 'description'); $tag_ID = wp_insert_term($tag_name, 'post_tag', $tagarr); } } function process_author($post) { $author = $this->get_tag( $post, 'dc:creator' ); if ($author) $this->allauthornames[] = $author; } function process_posts() { $i = -1; echo ''.__('Sorry, there has been an error.').'
'; echo '' . $file['error'] . '
'; return false; } $this->file = $file['file']; $this->id = (int) $file['id']; return true; } function dispatch() { if (empty ($_GET['step'])) $step = 0; else $step = (int) $_GET['step']; $this->header(); switch ($step) { case 0 : $this->greet(); break; case 1 : check_admin_referer('import-upload'); if ( $this->handle_upload() ) $this->select_authors(); break; case 2: check_admin_referer('import-wordpress'); $result = $this->import( $_GET['id'], $_POST['attachments'] ); if ( is_wp_error( $result ) ) echo $result->get_error_message(); break; } $this->footer(); } function WP_Import() { // Nothing. } } $wp_import = new WP_Import(); register_importer('wordpress', 'WordPress', __('Import posts, comments, custom fields, pages, and categories from a WordPress export file'), array ($wp_import, 'dispatch')); ?>