}
}
-/*
- Identify UTF-8 text
- Taken from http://www.php.net/manual/fr/function.mb-detect-encoding.php#50087
-*/
-//
-// utf8 encoding validation developed based on Wikipedia entry at:
-// http://en.wikipedia.org/wiki/UTF-8
-//
-// Implemented as a recursive descent parser based on a simple state machine
-// copyright 2005 Maarten Meijer
-//
-// This cries out for a C-implementation to be included in PHP core
-//
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $char
- * @return string
- */
-function valid_1byte($char) {
- if(!is_int($char)) return false;
- return ($char & 0x80) == 0x00;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $char
- * @return string
- */
-function valid_2byte($char) {
- if(!is_int($char)) return false;
- return ($char & 0xE0) == 0xC0;
-}
-
/**
- * @package WordPress
- * @subpackage Dotclear_Import
+ * Convert from dotclear charset to utf8 if required
*
- * @param string $char
- * @return string
- */
-function valid_3byte($char) {
- if(!is_int($char)) return false;
- return ($char & 0xF0) == 0xE0;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $char
- * @return string
- */
-function valid_4byte($char) {
- if(!is_int($char)) return false;
- return ($char & 0xF8) == 0xF0;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $char
- * @return string
- */
-function valid_nextbyte($char) {
- if(!is_int($char)) return false;
- return ($char & 0xC0) == 0x80;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $string
- * @return string
- */
-function valid_utf8($string) {
- $len = strlen($string);
- $i = 0;
- while( $i < $len ) {
- $char = ord(substr($string, $i++, 1));
- if(valid_1byte($char)) { // continue
- continue;
- } else if(valid_2byte($char)) { // check 1 byte
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- } else if(valid_3byte($char)) { // check 2 bytes
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- } else if(valid_4byte($char)) { // check 3 bytes
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- } // goto next char
- }
- return true; // done
-}
-
-/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @return string
*/
function csc ($s) {
- if (valid_utf8 ($s)) {
+ if (seems_utf8 ($s)) {
return $s;
} else {
return iconv(get_option ("dccharset"),"UTF-8",$s);
echo '<form action="admin.php?import=dotclear&step=1" method="post">';
wp_nonce_field('import-dotclear');
$this->db_form();
- echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.attribute_escape(__('Import Categories')).'" /></p>';
+ echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import Categories').'" /></p>';
echo '</form></div>';
}
// Store category translation for future use
add_option('dccat2wpcat',$dccat2wpcat);
- echo '<p>'.sprintf(__ngettext('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
+ echo '<p>'.sprintf(_n('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
return true;
}
echo __('No Categories to Import!');
$web = "http://".$wpdb->escape($comment_site);
$message = $wpdb->escape(textconv ($comment_content));
- if($cinfo = comment_exists($name, $comment_dt))
- {
- // Update comments
- $ret_id = wp_update_comment(array(
- 'comment_ID' => $cinfo,
+ $comment = array(
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_date' => $comment_dt,
'comment_date_gmt' => $comment_dt,
'comment_content' => $message,
- 'comment_approved' => $comment_approved)
- );
- }
- else
- {
+ 'comment_approved' => $comment_approved);
+ $comment = wp_filter_comment($comment);
+
+ if ( $cinfo = comment_exists($name, $comment_dt) ) {
+ // Update comments
+ $comment['comment_ID'] = $cinfo;
+ $ret_id = wp_update_comment($comment);
+ } else {
// Insert comments
- $ret_id = wp_insert_comment(array(
- 'comment_post_ID' => $comment_post_ID,
- 'comment_author' => $name,
- 'comment_author_email' => $email,
- 'comment_author_url' => $web,
- 'comment_author_IP' => $comment_ip,
- 'comment_date' => $comment_dt,
- 'comment_date_gmt' => $comment_dt,
- 'comment_content' => $message,
- 'comment_approved' => $comment_approved)
- );
+ $ret_id = wp_insert_comment($comment);
}
$dccm2wpcm[$comment_ID] = $ret_id;
}
}
add_option('dclinks2wplinks',$dclinks2wplinks);
echo '<p>';
- printf(__ngettext('Done! <strong>%s</strong> link or link category imported.', 'Done! <strong>%s</strong> links or link categories imported.', $count), $count);
+ printf(_n('Done! <strong>%s</strong> link or link category imported.', 'Done! <strong>%s</strong> links or link categories imported.', $count), $count);
echo '<br /><br /></p>';
return true;
}
echo '<form action="admin.php?import=dotclear&step=2" method="post">';
wp_nonce_field('import-dotclear');
- printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Users')));
+ printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Users'));
echo '</form>';
}
echo '<form action="admin.php?import=dotclear&step=3" method="post">';
wp_nonce_field('import-dotclear');
- printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Posts')));
+ printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Posts'));
echo '</form>';
}
echo '<form action="admin.php?import=dotclear&step=4" method="post">';
wp_nonce_field('import-dotclear');
- printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Comments')));
+ printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Comments'));
echo '</form>';
}
echo '<form action="admin.php?import=dotclear&step=5" method="post">';
wp_nonce_field('import-dotclear');
- printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Links')));
+ printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Links'));
echo '</form>';
}
echo '<form action="admin.php?import=dotclear&step=6" method="post">';
wp_nonce_field('import-dotclear');
- printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Finish')));
+ printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Finish'));
echo '</form>';
}
{
echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from DotClear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
echo '<h3>'.__('Users').'</h3>';
- echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn\'t have that login in DotClear, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and DotClear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';
+ echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn’t have that login in DotClear, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and DotClear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Log in</a> and change it.'), '/wp-login.php').'</p>';
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/category/development/wordpress/textile/">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://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">log in</a>!'), '../wp-login.php').'</p>';
}
function db_form()