i18n fixes from nbachiyski. fixes #3109
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4d667513b5
commit
a4f582c8e6
|
@ -135,13 +135,13 @@ class Blogger_Import {
|
|||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
||||
$response = curl_exec ($ch);
|
||||
|
||||
|
||||
if ($parse) {
|
||||
$response = $this->parse_response($response);
|
||||
$response['url'] = $url;
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ class Blogger_Import {
|
|||
$this->import['blogs'][$_GET['blog']]['nextstep'] = $step;
|
||||
update_option('import-blogger', $this->import);
|
||||
}
|
||||
|
||||
|
||||
// Redirects to next step
|
||||
function do_next_step() {
|
||||
wp_redirect("admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
|
||||
|
@ -224,13 +224,13 @@ class Blogger_Import {
|
|||
if ( ! ( $_POST['user'] && $_POST['pass'] ) ) {
|
||||
$this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>');
|
||||
}
|
||||
|
||||
// Try logging in. If we get an array of cookies back, we at least connected.
|
||||
|
||||
// Try logging in. If we get an array of cookies back, we at least connected.
|
||||
$this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']);
|
||||
if ( !is_array( $this->import['cookies'] ) ) {
|
||||
$this->login_form(__('Login failed. Please enter your credentials again.'));
|
||||
}
|
||||
|
||||
|
||||
// Save the password so we can log the browser in when it's time to publish.
|
||||
$this->import['pass'] = $_POST['pass'];
|
||||
$this->import['user'] = $_POST['user'];
|
||||
|
@ -341,7 +341,7 @@ class Blogger_Import {
|
|||
$form = "<div style='height:0px;width:0px;overflow:hidden;'>";
|
||||
$form.= $body;
|
||||
$form.= "</div><script type='text/javascript'>forms=document.getElementsByTagName('form');for(i=0;i<forms.length;i++){if(forms[i].action.search('{$blog_opt}')){forms[i].submit();break;}}</script>";
|
||||
$output.= '<p>'.sprintf('<strong>%s</strong> in progress, please wait...', $blog_opt)."</p>\n";
|
||||
$output.= '<p>'.sprintf(__('<strong>%s</strong> in progress, please wait...'), $blog_opt)."</p>\n";
|
||||
} else {
|
||||
$output.= "<p>$blog_opt</p>\n";
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ class Blogger_Import {
|
|||
update_option('import-blogger', $import);
|
||||
$archive = $this->get_blogger($url);
|
||||
if ( $archive['code'] > 200 )
|
||||
continue;
|
||||
continue;
|
||||
$posts = explode('<wordpresspost>', $archive['body']);
|
||||
for ($i = 1; $i < count($posts); $i = $i + 1) {
|
||||
$postparts = explode('<wordpresscomment>', $posts[$i]);
|
||||
|
@ -409,7 +409,7 @@ class Blogger_Import {
|
|||
$post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3];
|
||||
$post_author_name = $wpdb->escape(trim($postinfo[1]));
|
||||
$post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org';
|
||||
|
||||
|
||||
if ( $this->lump_authors ) {
|
||||
// Ignore Blogger authors. Use the current user_ID for all posts imported.
|
||||
$post_author = $GLOBALS['user_ID'];
|
||||
|
@ -420,7 +420,7 @@ class Blogger_Import {
|
|||
$user_email = $wpdb->escape($post_author_email);
|
||||
$user_password = substr(md5(uniqid(microtime())), 0, 6);
|
||||
$result = wp_create_user( $user_login, $user_password, $user_email );
|
||||
$status.= sprintf('Registered user <strong>%s</strong>.', $user_login);
|
||||
$status.= sprintf(__('Registered user <strong>%s</strong>.'), $user_login);
|
||||
$this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login;
|
||||
}
|
||||
$userdata = get_userdatabylogin( $post_author_name );
|
||||
|
@ -435,21 +435,21 @@ class Blogger_Import {
|
|||
$posthour = zeroise($post_date_His[0], 2);
|
||||
$postminute = zeroise($post_date_His[1], 2);
|
||||
$postsecond = zeroise($post_date_His[2], 2);
|
||||
|
||||
|
||||
if (($post_date[2] == 'PM') && ($posthour != '12'))
|
||||
$posthour = $posthour + 12;
|
||||
else if (($post_date[2] == 'AM') && ($posthour == '12'))
|
||||
$posthour = '00';
|
||||
|
||||
|
||||
$post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
|
||||
|
||||
|
||||
$post_content = addslashes($post_content);
|
||||
$post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;)
|
||||
|
||||
|
||||
$post_title = addslashes($post_title);
|
||||
|
||||
|
||||
$post_status = 'publish';
|
||||
|
||||
|
||||
if ( $ID = post_exists($post_title, '', $post_date) ) {
|
||||
$post_array[$i]['ID'] = $ID;
|
||||
$skippedpostcount++;
|
||||
|
@ -509,7 +509,7 @@ class Blogger_Import {
|
|||
}
|
||||
}
|
||||
$status = sprintf(__('%s post(s) parsed, %s skipped...'), $postcount, $skippedpostcount).' '.
|
||||
sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcoun, $skippedcommentcount).' '.
|
||||
sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcount, $skippedcommentcount).' '.
|
||||
' <strong>'.__('Done').'</strong>';
|
||||
$import = $this->import;
|
||||
$import['blogs'][$_GET['blog']]['archives']["$url"] = $status;
|
||||
|
@ -546,7 +546,7 @@ class Blogger_Import {
|
|||
$response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode={$optary['backup']['publishMode']}", $headers);
|
||||
sleep(2);
|
||||
if ( $response['code'] >= 400 )
|
||||
die('<h1>Error restoring publishMode.</h1><p>Please tell the devs.</p>' . addslashes(print_r($response, 1)) );
|
||||
die('<h1>'.__('Error restoring publishMode').'</h1><p>'.__('Please tell the devs.').'</p>' . addslashes(print_r($response, 1)) );
|
||||
}
|
||||
}
|
||||
if ( $optary['backup'] != $optary['modify'] ) {
|
||||
|
@ -597,11 +597,11 @@ class Blogger_Import {
|
|||
if ( $_GET['restart'] == 'true' ) {
|
||||
$this->restart();
|
||||
}
|
||||
|
||||
|
||||
if ( isset($_GET['noheader']) ) {
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$this->import = get_settings('import-blogger');
|
||||
$this->import = get_option('import-blogger');
|
||||
|
||||
if ( false === $this->import ) {
|
||||
$step = 0;
|
||||
|
@ -649,7 +649,7 @@ class Blogger_Import {
|
|||
break;
|
||||
}
|
||||
die;
|
||||
|
||||
|
||||
} else {
|
||||
$this->greet();
|
||||
}
|
||||
|
@ -662,6 +662,6 @@ class Blogger_Import {
|
|||
|
||||
$blogger_import = new Blogger_Import();
|
||||
|
||||
register_importer('blogger', 'Blogger', __('Import posts and comments from a 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'));
|
||||
|
||||
?>
|
||||
|
|
|
@ -626,15 +626,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()
|
||||
|
@ -737,5 +737,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'));
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,313 @@
|
|||
<?php
|
||||
|
||||
class GM_Import {
|
||||
|
||||
var $gmnames = array ();
|
||||
|
||||
function header() {
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Import Greymatter').'</h2>';
|
||||
}
|
||||
|
||||
function footer() {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function greet() {
|
||||
$this->header();
|
||||
?>
|
||||
<p><?php _e('This is a basic GreyMatter to WordPress import script.') ?></p>
|
||||
<p><?php _e('What it does:') ?></p>
|
||||
<ul>
|
||||
<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><?php _e('What it does not:') ?></p>
|
||||
<ul>
|
||||
<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> </p>
|
||||
|
||||
<form name="stepOne" method="get">
|
||||
<input type="hidden" name="import" value="greymatter" />
|
||||
<input type="hidden" name="step" value="1" />
|
||||
<h3><?php _e('Second step: GreyMatter details:') ?></h3>
|
||||
<p><table cellpadding="0">
|
||||
<tr>
|
||||
<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><?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 /><?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><?php _e("Last entry's number:") ?></td>
|
||||
<td><input type="text" name="lastentry" value="00000001" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</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> </p>
|
||||
<?php
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function gm2autobr($string) { // transforms GM's |*| into b2's <br />\n
|
||||
$string = str_replace("|*|","<br />\n",$string);
|
||||
return($string);
|
||||
}
|
||||
|
||||
function import() {
|
||||
global $wpdb;
|
||||
|
||||
$wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
|
||||
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
$wpvar = $wpvarstoreset[$i];
|
||||
if (!isset($$wpvar)) {
|
||||
if (empty($_POST["$wpvar"])) {
|
||||
if (empty($_GET["$wpvar"])) {
|
||||
$$wpvar = '';
|
||||
} else {
|
||||
$$wpvar = $_GET["$wpvar"];
|
||||
}
|
||||
} else {
|
||||
$$wpvar = $_POST["$wpvar"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!chdir($archivespath))
|
||||
die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $archivespath));
|
||||
|
||||
if (!chdir($gmpath))
|
||||
die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $gmpath));
|
||||
|
||||
$this->header();
|
||||
?>
|
||||
<p><?php _e('The importer is running...') ?></p>
|
||||
<ul>
|
||||
<li><?php _e('importing users...') ?><ul><?php
|
||||
|
||||
chdir($gmpath);
|
||||
$userbase = file("gm-authors.cgi");
|
||||
|
||||
foreach($userbase as $user) {
|
||||
$userdata=explode("|", $user);
|
||||
|
||||
$user_ip="127.0.0.1";
|
||||
$user_domain="localhost";
|
||||
$user_browser="server";
|
||||
|
||||
$s=$userdata[4];
|
||||
$user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00";
|
||||
|
||||
$user_login=$wpdb->escape($userdata[0]);
|
||||
$pass1=$wpdb->escape($userdata[1]);
|
||||
$user_nickname=$wpdb->escape($userdata[0]);
|
||||
$user_email=$wpdb->escape($userdata[2]);
|
||||
$user_url=$wpdb->escape($userdata[3]);
|
||||
$user_joindate=$wpdb->escape($user_joindate);
|
||||
|
||||
$user_id = username_exists($user_login);
|
||||
if ($user_id) {
|
||||
printf('<li>'.__('user %s').'<strong>'.__('Already exists').'</strong></li>', "<em>$user_login</em>");
|
||||
$this->gmnames[$userdata[0]] = $user_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
$user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname");
|
||||
$user_id = wp_insert_user($user_info);
|
||||
$this->gmnames[$userdata[0]] = $user_id;
|
||||
|
||||
printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>");
|
||||
}
|
||||
|
||||
?></ul><strong><?php _e('Done') ?></strong></li>
|
||||
<li><?php _e('importing posts, comments, and karma...') ?><br /><ul><?php
|
||||
|
||||
chdir($archivespath);
|
||||
|
||||
for($i = 0; $i <= $lastentry; $i = $i + 1) {
|
||||
|
||||
$entryfile = "";
|
||||
|
||||
if ($i<10000000) {
|
||||
$entryfile .= "0";
|
||||
if ($i<1000000) {
|
||||
$entryfile .= "0";
|
||||
if ($i<100000) {
|
||||
$entryfile .= "0";
|
||||
if ($i<10000) {
|
||||
$entryfile .= "0";
|
||||
if ($i<1000) {
|
||||
$entryfile .= "0";
|
||||
if ($i<100) {
|
||||
$entryfile .= "0";
|
||||
if ($i<10) {
|
||||
$entryfile .= "0";
|
||||
}}}}}}}
|
||||
|
||||
$entryfile .= "$i";
|
||||
|
||||
if (is_file($entryfile.".cgi")) {
|
||||
|
||||
$entry=file($entryfile.".cgi");
|
||||
$postinfo=explode("|",$entry[0]);
|
||||
$postmaincontent=$this->gm2autobr($entry[2]);
|
||||
$postmorecontent=$this->gm2autobr($entry[3]);
|
||||
|
||||
$post_author=trim($wpdb->escape($postinfo[1]));
|
||||
|
||||
$post_title=$this->gm2autobr($postinfo[2]);
|
||||
printf('<li>'.__('entry # %s : %s : by %s'), $entryfile, $post_title, $postinfo[1]);
|
||||
$post_title=$wpdb->escape($post_title);
|
||||
|
||||
$postyear=$postinfo[6];
|
||||
$postmonth=zeroise($postinfo[4],2);
|
||||
$postday=zeroise($postinfo[5],2);
|
||||
$posthour=zeroise($postinfo[7],2);
|
||||
$postminute=zeroise($postinfo[8],2);
|
||||
$postsecond=zeroise($postinfo[9],2);
|
||||
|
||||
if (($postinfo[10]=="PM") && ($posthour!="12"))
|
||||
$posthour=$posthour+12;
|
||||
|
||||
$post_date="$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
|
||||
|
||||
$post_content=$postmaincontent;
|
||||
if (strlen($postmorecontent)>3)
|
||||
$post_content .= "<!--more--><br /><br />".$postmorecontent;
|
||||
$post_content=$wpdb->escape($post_content);
|
||||
|
||||
$post_karma=$postinfo[12];
|
||||
|
||||
$post_status = 'publish'; //in greymatter, there are no drafts
|
||||
$comment_status = 'open';
|
||||
$ping_status = 'closed';
|
||||
|
||||
if ($post_ID = post_exists($post_title, '', $post_date)) {
|
||||
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
|
||||
$user_id = username_exists($post_author);
|
||||
if (!$user_id) { // if deleted from GM, we register the author as a level 0 user
|
||||
$user_ip="127.0.0.1";
|
||||
$user_domain="localhost";
|
||||
$user_browser="server";
|
||||
$user_joindate="1979-06-06 00:41:00";
|
||||
$user_login=$wpdb->escape($post_author);
|
||||
$pass1=$wpdb->escape("password");
|
||||
$user_nickname=$wpdb->escape($post_author);
|
||||
$user_email=$wpdb->escape("user@deleted.com");
|
||||
$user_url=$wpdb->escape("");
|
||||
$user_joindate=$wpdb->escape($user_joindate);
|
||||
|
||||
$user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname");
|
||||
$user_id = wp_insert_user($user_info);
|
||||
$this->gmnames[$postinfo[1]] = $user_id;
|
||||
|
||||
echo ': ';
|
||||
printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>");
|
||||
}
|
||||
|
||||
if (array_key_exists($postinfo[1], $this->gmnames)) {
|
||||
$post_author = $this->gmnames[$postinfo[1]];
|
||||
} else {
|
||||
$post_author = $user_id;
|
||||
}
|
||||
|
||||
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
|
||||
$post_ID = wp_insert_post($postdata);
|
||||
}
|
||||
|
||||
$c=count($entry);
|
||||
if ($c>4) {
|
||||
$numAddedComments = 0;
|
||||
$numComments = 0;
|
||||
for ($j=4;$j<$c;$j++) {
|
||||
$entry[$j]=$this->gm2autobr($entry[$j]);
|
||||
$commentinfo=explode("|",$entry[$j]);
|
||||
$comment_post_ID=$post_ID;
|
||||
$comment_author=$wpdb->escape($commentinfo[0]);
|
||||
$comment_author_email=$wpdb->escape($commentinfo[2]);
|
||||
$comment_author_url=$wpdb->escape($commentinfo[3]);
|
||||
$comment_author_IP=$wpdb->escape($commentinfo[1]);
|
||||
|
||||
$commentyear=$commentinfo[7];
|
||||
$commentmonth=zeroise($commentinfo[5],2);
|
||||
$commentday=zeroise($commentinfo[6],2);
|
||||
$commenthour=zeroise($commentinfo[8],2);
|
||||
$commentminute=zeroise($commentinfo[9],2);
|
||||
$commentsecond=zeroise($commentinfo[10],2);
|
||||
if (($commentinfo[11]=="PM") && ($commenthour!="12"))
|
||||
$commenthour=$commenthour+12;
|
||||
$comment_date="$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond";
|
||||
|
||||
$comment_content=$wpdb->escape($commentinfo[12]);
|
||||
|
||||
if (!comment_exists($comment_author, $comment_date)) {
|
||||
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_approved');
|
||||
$commentdata = wp_filter_comment($commentdata);
|
||||
wp_insert_comment($commentdata);
|
||||
$numAddedComments++;
|
||||
}
|
||||
$numComments++;
|
||||
}
|
||||
if ($numAddedComments > 0) {
|
||||
echo ': ';
|
||||
printf(__('imported %d comment(s)'), $numAddedComments);
|
||||
}
|
||||
$preExisting = $numComments - numAddedComments;
|
||||
if ($preExisting > 0) {
|
||||
echo ' ';
|
||||
printf(__('ignored %d pre-existing comments'), $preExisting);
|
||||
}
|
||||
}
|
||||
echo '... <strong>'.__('Done').'</strong></li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul><strong><?php _e('Done') ?></strong></li></ul>
|
||||
<p> </p>
|
||||
<p><?php _e('Completed Greymatter import!') ?></p>
|
||||
<?php
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function dispatch() {
|
||||
if (empty ($_GET['step']))
|
||||
$step = 0;
|
||||
else
|
||||
$step = (int) $_GET['step'];
|
||||
|
||||
switch ($step) {
|
||||
case 0 :
|
||||
$this->greet();
|
||||
break;
|
||||
case 1:
|
||||
$this->import();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function GM_Import() {
|
||||
// Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
$gm_import = new GM_Import();
|
||||
|
||||
register_importer('greymatter', __('Greymatter'), __('Import posts and comments from your Greymatter blog'), array ($gm_import, 'dispatch'));
|
||||
?>
|
|
@ -167,5 +167,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'));
|
||||
?>
|
||||
|
|
|
@ -11,7 +11,7 @@ class MT_Import {
|
|||
|
||||
function header() {
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Import Movable Type').'</h2>';
|
||||
echo '<h2>'.__('Import Movable Type and Typepad').'</h2>';
|
||||
}
|
||||
|
||||
function footer() {
|
||||
|
@ -32,7 +32,7 @@ class MT_Import {
|
|||
global $wpdb, $testing;
|
||||
$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
|
||||
?><select name="userselect[<?php echo $n; ?>]">
|
||||
<option value="#NONE#">- Select -</option>
|
||||
<option value="#NONE#"><?php _e('- Select -') ?></option>
|
||||
<?php
|
||||
|
||||
|
||||
|
@ -134,6 +134,8 @@ class MT_Import {
|
|||
|
||||
function mt_authors_form() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Assign Authors'); ?></h2>
|
||||
<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
|
||||
<p><?php _e('Below, you can see the names of the authors of the MovableType posts in <i>italics</i>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
|
||||
<p><?php _e('If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)'); ?></p>
|
||||
|
@ -146,22 +148,24 @@ 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>';
|
||||
echo '</ol></div>';
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
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'];
|
||||
|
@ -174,7 +178,7 @@ class MT_Import {
|
|||
function process_posts() {
|
||||
global $wpdb;
|
||||
$i = -1;
|
||||
echo "<ol>";
|
||||
echo "<div class='wrap'><ol>";
|
||||
foreach ($this->posts as $post) {
|
||||
if ('' != trim($post)) {
|
||||
++ $i;
|
||||
|
@ -330,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
|
||||
|
@ -378,22 +382,22 @@ class MT_Import {
|
|||
}
|
||||
}
|
||||
if ( $num_pings )
|
||||
printf(__('(%s pings)'), $num_pings);
|
||||
|
||||
printf(' '.__('(%s pings)'), $num_pings);
|
||||
|
||||
echo "</li>";
|
||||
}
|
||||
flush();
|
||||
}
|
||||
|
||||
echo '</ol>';
|
||||
|
||||
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></div>';
|
||||
}
|
||||
|
||||
function import() {
|
||||
$this->id = (int) $_GET['id'];
|
||||
|
||||
$this->file = get_attached_file($this->id);
|
||||
$this->get_authors_from_post();
|
||||
$this->get_entries();
|
||||
|
@ -420,11 +424,11 @@ class MT_Import {
|
|||
}
|
||||
|
||||
function MT_Import() {
|
||||
// Nothing.
|
||||
// Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
$mt_import = new MT_Import();
|
||||
|
||||
register_importer('mt', 'Movable Type', __('Import posts and comments from your Movable Type 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'));
|
||||
?>
|
||||
|
|
|
@ -168,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'));
|
||||
?>
|
||||
|
|
|
@ -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'));
|
||||
?>
|
||||
|
|
|
@ -81,7 +81,7 @@ case 'edit':
|
|||
?>
|
||||
<div id='preview' class='wrap'>
|
||||
<h2 id="preview-post"><?php _e('Post Preview (updated when post is saved)'); ?> <small class="quickjump"><a href="#write-post"><?php _e('edit ↑'); ?></a></small></h2>
|
||||
<iframe src="<?php echo add_query_arg('preview', 'true', get_permalink($post->ID)); ?>" width="100%" height="600" ></iframe>
|
||||
<iframe src="<?php echo apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID))); ?>" width="100%" height="600" ></iframe>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
|
|
|
@ -822,9 +822,9 @@ class retrospam_mgr {
|
|||
$cnt++;
|
||||
}
|
||||
}
|
||||
echo "<div class='updated'><p>$cnt comment";
|
||||
if ($cnt != 1 ) echo "s";
|
||||
echo " moved to the moderation queue.</p></div>\n";
|
||||
echo "<div class='updated'><p> ";
|
||||
printf(__('%d comment(s) moved to the moderation queue.'), $cnt);
|
||||
echo "</p></div>\n";
|
||||
} // End function move_spam
|
||||
|
||||
function find_spam() {
|
||||
|
@ -853,7 +853,7 @@ class retrospam_mgr {
|
|||
$numfound = count($counters[found]);
|
||||
$numqueue = $counters[in_queue];
|
||||
|
||||
$body = '<p>' . sprintf(__('Suspected spam comments: <strong>%s</strong>'), $numfound) . '</p>';
|
||||
$body = '<p>' . sprintf(__('Suspected spam comments: %s'), "<strong>$numfound</strong>") . '</p>';
|
||||
|
||||
if ( count($counters[found]) > 0 ) {
|
||||
$id_list = implode( ',', $counters[found] );
|
||||
|
|
Loading…
Reference in New Issue