'; screen_icon(); echo '
'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import the posts, pages, comments, custom fields, categories, and tags 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(''.__('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', array('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' ); $category_description = $this->get_tag( $c, 'wp:category_description' ); $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', 'category_description'); print "" . __( "Importing category $cat_name" ) . "'.__('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'); $fetch_attachments = (!empty($_POST['attachments'])) ? true : false; $result = $this->import( $_GET['id'], $fetch_attachments); if ( is_wp_error( $result ) ) echo $result->get_error_message(); break; } $this->footer(); } function WP_Import() { // Nothing. } } /** * Register WordPress Importer * * @since unknown * @var WP_Import * @name $wp_import */ $wp_import = new WP_Import(); register_importer('wordpress', 'WordPress', __('Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), array ($wp_import, 'dispatch')); ?>