summaryrefslogtreecommitdiffstats
path: root/wp-admin/import
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-08 10:57:32 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-08 10:57:32 +0000
commite30516b2ee40c1c45c8f288c20a3d4372e478624 (patch)
treebd6b8bcc4c06697f50e6985a6b08620e25bc572e /wp-admin/import
parente20c9aa016d6885c6e3fc7425525b4090f05ac2a (diff)
downloadwordpress-mu-e30516b2ee40c1c45c8f288c20a3d4372e478624.tar.gz
wordpress-mu-e30516b2ee40c1c45c8f288c20a3d4372e478624.tar.xz
wordpress-mu-e30516b2ee40c1c45c8f288c20a3d4372e478624.zip
WP Merge to #4124
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@734 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/import')
-rw-r--r--wp-admin/import/blogger.php2
-rw-r--r--wp-admin/import/blogware.php2
-rw-r--r--wp-admin/import/dotclear.php8
-rw-r--r--wp-admin/import/greymatter.php75
-rw-r--r--wp-admin/import/livejournal.php2
-rw-r--r--wp-admin/import/mt.php47
-rw-r--r--wp-admin/import/rss.php23
-rw-r--r--wp-admin/import/textpattern.php6
-rw-r--r--wp-admin/import/wordpress.php35
9 files changed, 126 insertions, 74 deletions
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php
index 6328f16..c7c41d3 100644
--- a/wp-admin/import/blogger.php
+++ b/wp-admin/import/blogger.php
@@ -670,6 +670,6 @@ class Blogger_Import {
$blogger_import = new Blogger_Import();
-register_importer('blogger', 'Blogger and Blogspot', __('Import <strong>posts and comments</strong> from your Blogger account'), array ($blogger_import, 'start'));
+register_importer('blogger', __('Blogger and Blogspot'), __('Import <strong>posts and comments</strong> from your Blogger account'), array ($blogger_import, 'start'));
?>
diff --git a/wp-admin/import/blogware.php b/wp-admin/import/blogware.php
index 35ab610..abb43d5 100644
--- a/wp-admin/import/blogware.php
+++ b/wp-admin/import/blogware.php
@@ -188,5 +188,5 @@ class BW_Import {
$blogware_import = new BW_Import();
-register_importer('blogware', 'Blogware', __('Import posts from Blogware'), array ($blogware_import, 'dispatch'));
+register_importer('blogware', __('Blogware'), __('Import posts from Blogware'), array ($blogware_import, 'dispatch'));
?>
diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php
index 27ce6e6..ba988f6 100644
--- a/wp-admin/import/dotclear.php
+++ b/wp-admin/import/dotclear.php
@@ -632,15 +632,15 @@ class Dotclear_Import {
echo '<h3>'.__('Preserving Authors').'</h3>';
echo '<p>'.__('Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
echo '<h3>'.__('Textile').'</h3>';
- echo '<p>'.__('Also, since you\'re coming from Dotclear, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/2004/04/19/wordpress-plugin-textile-20/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>';
+ echo '<p>'.__('Also, since you\'re coming from Dotclear, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>';
echo '<h3>'.__('WordPress Resources').'</h3>';
echo '<p>'.__('Finally, there are numerous WordPress resources around the internet. Some of them are:').'</p>';
echo '<ul>';
echo '<li>'.__('<a href="http://www.wordpress.org">The official WordPress site</a>').'</li>';
- echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums').'</li>';
+ echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
echo '</ul>';
- echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
+ echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '../wp-login.php').'</p>';
}
function db_form()
@@ -743,5 +743,5 @@ class Dotclear_Import {
}
$dc_import = new Dotclear_Import();
-register_importer('dotclear', 'Dotclear', __('Import posts from a Dotclear Blog'), array ($dc_import, 'dispatch'));
+register_importer('dotclear', __('Dotclear'), __('Import posts from a Dotclear Blog'), array ($dc_import, 'dispatch'));
?>
diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php
index 8f7b34a..5494197 100644
--- a/wp-admin/import/greymatter.php
+++ b/wp-admin/import/greymatter.php
@@ -16,44 +16,44 @@ class GM_Import {
function greet() {
$this->header();
?>
-<p>This is a basic GreyMatter to WordPress import script.</p>
-<p>What it does:</p>
+<p><?php _e('This is a basic GreyMatter to WordPress import script.') ?></p>
+<p><?php _e('What it does:') ?></p>
<ul>
-<li>Parses gm-authors.cgi to import (new) authors. Everyone is imported at level 1.</li>
-<li>Parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on WordPress yet).<br />If authors are found not to be in gm-authors.cgi, imports them at level 0.</li>
-<li>Detects duplicate entries or comments. If you don't import everything the first time, or this import should fail in the middle, duplicate entries will not be made when you try again.</li>
+<li><?php _e('Parses gm-authors.cgi to import (new) authors. Everyone is imported at level 1.') ?></li>
+<li><?php _e('Parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on WordPress yet).<br />If authors are found not to be in gm-authors.cgi, imports them at level 0.') ?></li>
+<li><?php _e("Detects duplicate entries or comments. If you don't import everything the first time, or this import should fail in the middle, duplicate entries will not be made when you try again.") ?></li>
</ul>
-<p>What it does not:</p>
+<p><?php _e('What it does not:') ?></p>
<ul>
-<li>Parse gm-counter.cgi, gm-banlist.cgi, gm-cplog.cgi (you can make a CP log hack if you really feel like it, but I question the need of a CP log).</li>
-<li>Import gm-templates.</li>
-<li>Doesn't keep entries on top.</li>
+<li><?php _e('Parse gm-counter.cgi, gm-banlist.cgi, gm-cplog.cgi (you can make a CP log hack if you really feel like it, but I question the need of a CP log).') ?></li>
+<li><?php _e('Import gm-templates.') ?></li>
+<li><?php _e("Doesn't keep entries on top.")?></li>
</ul>
<p>&nbsp;</p>
<form name="stepOne" method="get">
<input type="hidden" name="import" value="greymatter" />
<input type="hidden" name="step" value="1" />
-<h3>Second step: GreyMatter details:</h3>
+<h3><?php _e('Second step: GreyMatter details:') ?></h3>
<p><table cellpadding="0">
<tr>
-<td>Path to GM files:</td>
+<td><?php _e('Path to GM files:') ?></td>
<td><input type="text" style="width:300px" name="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
</tr>
<tr>
-<td>Path to GM entries:</td>
+<td><?php _e('Path to GM entries:') ?></td>
<td><input type="text" style="width:300px" name="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
</tr>
<tr>
-<td colspan="2"><br />This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don't know that number, just log into your FTP and look it out<br />in the entries' folder)</td>
+<td colspan="2"><br /><?php _e("This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don't know that number, just log into your FTP and look it out<br />in the entries' folder)") ?></td>
</tr>
<tr>
-<td>Last entry's number:</td>
+<td><?php _e("Last entry's number:") ?></td>
<td><input type="text" name="lastentry" value="00000001" /></td>
</tr>
</table>
</p>
-<p>When you're ready, click OK to start importing: <input type="submit" name="submit" value="OK" class="search" /></p>
+<p><?php _e("When you're ready, click OK to start importing: ") ?><input type="submit" name="submit" value="<?php _e('OK') ?>" class="search" /></p>
</form>
<p>&nbsp</p>
<?php
@@ -87,16 +87,16 @@ class GM_Import {
}
if (!chdir($archivespath))
- wp_die("Wrong path, $archivespath\ndoesn't exist\non the server");
+ wp_die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $archivespath));
if (!chdir($gmpath))
- wp_die("Wrong path, $gmpath\ndoesn't exist\non the server");
+ wp_die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $gmpath));
$this->header();
?>
-<p>The importer is running...</p>
+<p><?php _e('The importer is running...') ?></p>
<ul>
-<li>importing users... <ul><?php
+<li><?php _e('importing users...') ?><ul><?php
chdir($gmpath);
$userbase = file("gm-authors.cgi");
@@ -120,7 +120,7 @@ class GM_Import {
$user_id = username_exists($user_login);
if ($user_id) {
- echo "<li>user <i>$user_login</i>... <b>Already exists</b></li>";
+ printf('<li>'.__('user %s').'<strong>'.__('Already exists').'</strong></li>', "<em>$user_login</em>");
$this->gmnames[$userdata[0]] = $user_id;
continue;
}
@@ -129,12 +129,11 @@ class GM_Import {
$user_id = wp_insert_user($user_info);
$this->gmnames[$userdata[0]] = $user_id;
- echo "<li>user <i>$user_login</i>... <b>Done</b></li>";
-
+ printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>");
}
-?></ul><b>Done</b></li>
-<li>importing posts, comments, and karma...<br /><ul><?php
+?></ul><strong><?php _e('Done') ?></strong></li>
+<li><?php _e('importing posts, comments, and karma...') ?><br /><ul><?php
chdir($archivespath);
@@ -163,7 +162,6 @@ class GM_Import {
if (is_file($entryfile.".cgi")) {
$entry=file($entryfile.".cgi");
- echo "<li>entry # $entryfile ";
$postinfo=explode("|",$entry[0]);
$postmaincontent=$this->gm2autobr($entry[2]);
$postmorecontent=$this->gm2autobr($entry[3]);
@@ -171,7 +169,7 @@ class GM_Import {
$post_author=trim($wpdb->escape($postinfo[1]));
$post_title=$this->gm2autobr($postinfo[2]);
- echo " : $post_title : by $postinfo[1]";
+ printf('<li>'.__('entry # %s : %s : by %s'), $entryfile, $post_title, $postinfo[1]);
$post_title=$wpdb->escape($post_title);
$postyear=$postinfo[6];
@@ -198,7 +196,8 @@ class GM_Import {
$ping_status = 'closed';
if ($post_ID = post_exists($post_title, '', $post_date)) {
- echo ' (already exists)';
+ echo ' ';
+ _e('(already exists)');
} else {
//just so that if a post already exists, new users are not created by checkauthor
// we'll check the author is registered, or if it's a deleted author
@@ -219,7 +218,8 @@ class GM_Import {
$user_id = wp_insert_user($user_info);
$this->gmnames[$postinfo[1]] = $user_id;
- echo ": registered deleted user <i>$user_login</i> at level 0 ";
+ echo ': ';
+ printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>");
}
if (array_key_exists($postinfo[1], $this->gmnames)) {
@@ -266,21 +266,22 @@ class GM_Import {
$numComments++;
}
if ($numAddedComments > 0) {
- echo ": imported $numAddedComments comment";
- if ($numAddedComments != 1)
- echo "s";
+ echo ': ';
+ printf(__('imported %d comment(s)'), $numAddedComments);
}
$preExisting = $numComments - numAddedComments;
- if ($preExisting > 0)
- echo " (ignored $preExisting pre-existing comments)";
+ if ($preExisting > 0) {
+ echo ' ';
+ printf(__('ignored %d pre-existing comments'), $preExisting);
+ }
}
- echo "... <b>Done</b></li>";
+ echo '... <strong>'.__('Done').'</strong></li>';
}
}
?>
-</ul><b>Done</b></li></ul>
+</ul><strong><?php _e('Done') ?></strong></li></ul>
<p>&nbsp;</p>
-<p>Completed Greymatter import !</p>
+<p><?php _e('Completed Greymatter import!') ?></p>
<?php
$this->footer();
}
@@ -308,5 +309,5 @@ class GM_Import {
$gm_import = new GM_Import();
-register_importer('greymatter', 'Greymatter', __('Import posts and comments from your Greymatter blog'), array ($gm_import, 'dispatch'));
+register_importer('greymatter', __('Greymatter'), __('Import posts and comments from your Greymatter blog'), array ($gm_import, 'dispatch'));
?>
diff --git a/wp-admin/import/livejournal.php b/wp-admin/import/livejournal.php
index 44b92a5..d0c6102 100644
--- a/wp-admin/import/livejournal.php
+++ b/wp-admin/import/livejournal.php
@@ -164,5 +164,5 @@ class LJ_Import {
$livejournal_import = new LJ_Import();
-register_importer('livejournal', 'LiveJournal', __('Import posts from LiveJournal'), array ($livejournal_import, 'dispatch'));
+register_importer('livejournal', __('LiveJournal'), __('Import posts from LiveJournal'), array ($livejournal_import, 'dispatch'));
?>
diff --git a/wp-admin/import/mt.php b/wp-admin/import/mt.php
index 59259ea..bf33718 100644
--- a/wp-admin/import/mt.php
+++ b/wp-admin/import/mt.php
@@ -32,7 +32,7 @@ class MT_Import {
global $wpdb, $testing;
$users = get_users_of_blog($wpdb->blogid);
?><select name="userselect[<?php echo $n; ?>]">
- <option value="#NONE#">- Select -</option>
+ <option value="#NONE#"><?php _e('- Select -') ?></option>
<?php
@@ -50,8 +50,25 @@ class MT_Import {
function checkauthor($author) {
global $wpdb;
//mtnames is an array with the names in the mt import file
- $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
- $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
+ $pass = 'changeme';
+ if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
+ ++ $this->j;
+ $this->mtnames[$this->j] = $author; //add that new mt author name to an array
+ $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
+ if (!$user_id) { //banging my head against the desk now.
+ if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
+ $user_id = wp_create_user($author, $pass);
+ $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
+ } else {
+ $user_id = wp_create_user($this->newauthornames[$this->j], $pass);
+ }
+ } else {
+ return $user_id; // return pre-existing wp username if it exists
+ }
+ } else {
+ $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
+ $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
+ }
return $user_id;
}
@@ -93,6 +110,13 @@ class MT_Import {
$formnames = array ();
$selectnames = array ();
+ foreach ($_POST['user'] as $key => $line) {
+ $newname = trim(stripslashes($line));
+ if ($newname == '')
+ $newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
+ array_push($formnames, "$newname");
+ } // $formnames is the array with the form entered names
+
foreach ($_POST['userselect'] as $user => $key) {
$selected = trim(stripslashes($key));
array_push($selectnames, "$selected");
@@ -124,12 +148,12 @@ class MT_Import {
$j = -1;
foreach ($authors as $author) {
++ $j;
- echo '<li><i>'.$author.'</i><br />'.'<input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30">';
+ echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
$this->users_form($j);
echo '</li>';
}
- echo '<input type="submit" value="Submit">'.'<br/>';
+ echo '<input type="submit" value="'.__('Submit').'">'.'<br/>';
echo '</form>';
echo '</ol></div>';
@@ -138,7 +162,10 @@ class MT_Import {
function select_authors() {
$file = wp_import_handle_upload();
if ( isset($file['error']) ) {
- echo $file['error'];
+ $this->header();
+ echo '<p>'.__('Sorry, there has been an error').'.</p>';
+ echo '<p><strong>' . $file['error'] . '</strong></p>';
+ $this->footer();
return;
}
$this->file = $file['file'];
@@ -170,7 +197,7 @@ class MT_Import {
// We want the excerpt
preg_match("|-----\nEXCERPT:(.*)|s", $post, $excerpt);
- $excerpt = $wpdb->escape(trim($excerpt[1]));
+ $post_excerpt = $wpdb->escape(trim($excerpt[1]));
$post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post);
// We're going to put extended body into main body with a more tag
@@ -307,7 +334,7 @@ class MT_Import {
}
}
if ( $num_comments )
- printf(__(' (%s comments)'), $num_comments);
+ printf(' '.__('(%s comments)'), $num_comments);
// Finally the pings
// fix the double newline on the first one
@@ -355,7 +382,7 @@ class MT_Import {
}
}
if ( $num_pings )
- printf(__(' (%s pings)'), $num_pings);
+ printf(' '.__('(%s pings)'), $num_pings);
echo "</li>";
}
@@ -403,5 +430,5 @@ class MT_Import {
$mt_import = new MT_Import();
-register_importer('mt', 'Movable Type and Typepad', __('Imports <strong>posts and comments</strong> from your Movable Type or Typepad blog'), array ($mt_import, 'dispatch'));
+register_importer('mt', __('Movable Type and Typepad'), __('Imports <strong>posts and comments</strong> from your Movable Type or Typepad blog'), array ($mt_import, 'dispatch'));
?>
diff --git a/wp-admin/import/rss.php b/wp-admin/import/rss.php
index 69972f3..aabfe4e 100644
--- a/wp-admin/import/rss.php
+++ b/wp-admin/import/rss.php
@@ -38,21 +38,22 @@ class RSS_Import {
$index = 0;
foreach ($this->posts as $post) {
preg_match('|<title>(.*?)</title>|is', $post, $post_title);
- $post_title = $wpdb->escape(trim($post_title[1]));
+ $post_title = str_replace(array('<![CDATA[', ']]>'), '', $wpdb->escape( trim($post_title[1]) ));
- preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date);
+ preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date_gmt);
- if ($post_date) {
- $post_date = strtotime($post_date[1]);
+ if ($post_date_gmt) {
+ $post_date_gmt = strtotime($post_date_gmt[1]);
} else {
// if we don't already have something from pubDate
- preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $post_date);
- $post_date = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date[1]);
- $post_date = str_replace('T', ' ', $post_date);
- $post_date = strtotime($post_date);
+ preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $post_date_gmt);
+ $post_date_gmt = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date_gmt[1]);
+ $post_date_gmt = str_replace('T', ' ', $post_date_gmt);
+ $post_date_gmt = strtotime($post_date_gmt);
}
- $post_date = gmdate('Y-m-d H:i:s', $post_date);
+ $post_date_gmt = gmdate('Y-m-d H:i:s', $post_date_gmt);
+ $post_date = get_date_from_gmt( $post_date_gmt );
preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
$categories = $categories[1];
@@ -90,7 +91,7 @@ class RSS_Import {
$post_author = 1;
$post_status = 'publish';
- $this->posts[$index] = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status', 'guid', 'categories');
+ $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories');
$index++;
}
}
@@ -167,5 +168,5 @@ class RSS_Import {
$rss_import = new RSS_Import();
-register_importer('rss', 'RSS', __('Import posts from an RSS feed'), array ($rss_import, 'dispatch'));
+register_importer('rss', __('RSS'), __('Import posts from an RSS feed'), array ($rss_import, 'dispatch'));
?>
diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php
index 4a123de..6af31aa 100644
--- a/wp-admin/import/textpattern.php
+++ b/wp-admin/import/textpattern.php
@@ -555,12 +555,12 @@ class Textpattern_Import {
echo '<h3>'.__('Preserving Authors').'</h3>';
echo '<p>'.__('Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
echo '<h3>'.__('Textile').'</h3>';
- echo '<p>'.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/2004/04/19/wordpress-plugin-textile-20/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>';
+ echo '<p>'.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>';
echo '<h3>'.__('WordPress Resources').'</h3>';
echo '<p>'.__('Finally, there are numerous WordPress resources around the internet. Some of them are:').'</p>';
echo '<ul>';
echo '<li>'.__('<a href="http://www.wordpress.org">The official WordPress site</a>').'</li>';
- echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums').'</li>';
+ echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
echo '</ul>';
echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
@@ -659,5 +659,5 @@ class Textpattern_Import {
}
$txp_import = new Textpattern_Import();
-register_importer('textpattern', 'Textpattern', __('Import posts from a Textpattern Blog'), array ($txp_import, 'dispatch'));
+register_importer('textpattern', __('Textpattern'), __('Import posts from a Textpattern Blog'), array ($txp_import, 'dispatch'));
?>
diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php
index 997628b..ded4b94 100644
--- a/wp-admin/import/wordpress.php
+++ b/wp-admin/import/wordpress.php
@@ -54,8 +54,24 @@ class WP_Import {
global $wpdb;
//mtnames is an array with the names in the mt import file
$pass = 'changeme';
- $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
- $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
+ if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
+ ++ $this->j;
+ $this->mtnames[$this->j] = $author; //add that new mt author name to an array
+ $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
+ if (!$user_id) { //banging my head against the desk now.
+ if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
+ $user_id = wp_create_user($author, $pass);
+ $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
+ } else {
+ $user_id = wp_create_user($this->newauthornames[$this->j], $pass);
+ }
+ } else {
+ return $user_id; // return pre-existing wp username if it exists
+ }
+ } else {
+ $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
+ $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
+ }
return $user_id;
}
@@ -96,6 +112,13 @@ class WP_Import {
$formnames = array ();
$selectnames = array ();
+ foreach ($_POST['user'] as $key => $line) {
+ $newname = trim(stripslashes($line));
+ if ($newname == '')
+ $newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
+ array_push($formnames, "$newname");
+ } // $formnames is the array with the form entered names
+
foreach ($_POST['userselect'] as $user => $key) {
$selected = trim(stripslashes($key));
array_push($selectnames, "$selected");
@@ -125,7 +148,7 @@ class WP_Import {
$j = -1;
foreach ($authors as $author) {
++ $j;
- echo '<li>Current author: <strong>'.$author.'</strong><br />'.'Map to existing: ';
+ echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
$this->users_form($j);
echo '</li>';
}
@@ -140,7 +163,7 @@ class WP_Import {
$file = wp_import_handle_upload();
if ( isset($file['error']) ) {
$this->header();
- echo '<p>Sorry, there has been an error.</p>';
+ echo '<p>'.__('Sorry, there has been an error.').'</p>';
echo '<p><strong>' . $file['error'] . '</strong></p>';
$this->footer();
return;
@@ -225,7 +248,7 @@ class WP_Import {
}
} }
if ( $num_comments )
- printf(__(' (%s comments)'), $num_comments);
+ printf(' '.__('(%s comments)'), $num_comments);
// Now for post meta
preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
@@ -243,7 +266,7 @@ class WP_Import {
wp_import_cleanup($this->id);
- echo '<h3>'.sprintf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')).'</h3>';
+ echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>';
}
function import() {