diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-11-24 16:16:44 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-11-24 16:16:44 +0000 |
commit | 600b71019494e1c29898a620e58c0d2602f37b74 (patch) | |
tree | 21181d77ad4ebbcd42cd883e509c08a568d29514 /wp-admin/import | |
parent | 7935d0bd9ef23d32ae29a95bd6c3ea0b6eab2973 (diff) | |
download | wordpress-mu-600b71019494e1c29898a620e58c0d2602f37b74.tar.gz wordpress-mu-600b71019494e1c29898a620e58c0d2602f37b74.tar.xz wordpress-mu-600b71019494e1c29898a620e58c0d2602f37b74.zip |
WP Merge to 4524
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@810 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/import')
-rw-r--r-- | wp-admin/import/blogger.php | 2 | ||||
-rw-r--r-- | wp-admin/import/blogware.php | 16 | ||||
-rw-r--r-- | wp-admin/import/dotclear.php | 137 | ||||
-rw-r--r-- | wp-admin/import/greymatter.php | 14 | ||||
-rw-r--r-- | wp-admin/import/mt.php | 2 | ||||
-rw-r--r-- | wp-admin/import/textpattern.php | 192 | ||||
-rw-r--r-- | wp-admin/import/wordpress.php | 2 |
7 files changed, 183 insertions, 182 deletions
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index c7c41d3..d7df5ad 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -525,7 +525,7 @@ class Blogger_Import { $did_one = true;
}
$output.= "<p>$archivename $status</p>\n";
- }
+ }
if ( ! $did_one )
$this->set_next_step(7);
die( $this->refresher(1000) . $output );
diff --git a/wp-admin/import/blogware.php b/wp-admin/import/blogware.php index 780e45d..2cbf75f 100644 --- a/wp-admin/import/blogware.php +++ b/wp-admin/import/blogware.php @@ -20,7 +20,7 @@ class BW_Import { $trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
-
+
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog. Pick a Blogware file to upload and click Import.').'</p>';
@@ -30,7 +30,7 @@ class BW_Import { function import_posts() {
global $wpdb, $current_user;
-
+
set_magic_quotes_runtime(0);
$importdata = file($this->file); // Read the file into an array
$importdata = implode('', $importdata); // squish it
@@ -39,7 +39,7 @@ class BW_Import { preg_match_all('|(<item[^>]+>(.*?)</item>)|is', $importdata, $posts);
$posts = $posts[1];
unset($importdata);
- echo '<ol>';
+ echo '<ol>';
foreach ($posts as $post) {
flush();
preg_match('|<item type=\"(.*?)\">|is', $post, $post_type);
@@ -102,7 +102,7 @@ class BW_Import { preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
$comments = $comments[1];
-
+
if ( $comments ) {
$comment_post_ID = $post_id;
$num_comments = 0;
@@ -157,7 +157,7 @@ class BW_Import { $this->file = $file['file'];
$this->import_posts();
wp_import_cleanup($file['id']);
-
+
echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>';
@@ -170,7 +170,7 @@ class BW_Import { $step = (int) $_GET['step'];
$this->header();
-
+
switch ($step) {
case 0 :
$this->greet();
@@ -179,12 +179,12 @@ class BW_Import { $this->import();
break;
}
-
+
$this->footer();
}
function BW_Import() {
- // Nothing.
+ // Nothing.
}
}
diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php index 026d871..02c030f 100644 --- a/wp-admin/import/dotclear.php +++ b/wp-admin/import/dotclear.php @@ -9,7 +9,7 @@ **/ if(!function_exists('get_catbynicename')) { - function get_catbynicename($category_nicename) + function get_catbynicename($category_nicename) { global $wpdb; @@ -60,57 +60,58 @@ if(!function_exists('link_exists')) // // This cries out for a C-implementation to be included in PHP core // - function valid_1byte($char) { - if(!is_int($char)) return false; - return ($char & 0x80) == 0x00; - } - - function valid_2byte($char) { - if(!is_int($char)) return false; - return ($char & 0xE0) == 0xC0; - } - - function valid_3byte($char) { - if(!is_int($char)) return false; - return ($char & 0xF0) == 0xE0; - } - - function valid_4byte($char) { - if(!is_int($char)) return false; - return ($char & 0xF8) == 0xF0; - } - - function valid_nextbyte($char) { - if(!is_int($char)) return false; - return ($char & 0xC0) == 0x80; - } - - 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 - } + +function valid_1byte($char) { + if(!is_int($char)) return false; + return ($char & 0x80) == 0x00; +} + +function valid_2byte($char) { + if(!is_int($char)) return false; + return ($char & 0xE0) == 0xC0; +} + +function valid_3byte($char) { + if(!is_int($char)) return false; + return ($char & 0xF0) == 0xE0; +} + +function valid_4byte($char) { + if(!is_int($char)) return false; + return ($char & 0xF8) == 0xF0; +} + +function valid_nextbyte($char) { + if(!is_int($char)) return false; + return ($char & 0xC0) == 0x80; +} + +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 +} function csc ($s) { if (valid_utf8 ($s)) { @@ -151,7 +152,7 @@ class Dotclear_Import { echo '</form></div>'; } - function get_dc_cats() + function get_dc_cats() { global $wpdb; // General Housekeeping @@ -186,7 +187,7 @@ class Dotclear_Import { // Get Posts return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie - ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); + ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); } function get_dc_comments() @@ -211,7 +212,7 @@ class Dotclear_Import { return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A); } - function cat2wp($categories='') + function cat2wp($categories='') { // General Housekeeping global $wpdb; @@ -221,7 +222,7 @@ class Dotclear_Import { if(is_array($categories)) { echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; - foreach ($categories as $category) + foreach ($categories as $category) { $count++; extract($category); @@ -283,7 +284,7 @@ class Dotclear_Import { 'display_name' => $Realname) ); } - else + else { $ret_id = wp_insert_user(array( 'user_login' => $user_id, @@ -384,7 +385,7 @@ class Dotclear_Import { 'comment_count' => $post_nb_comment + $post_nb_trackback) ); } - else + else { $ret_id = wp_insert_post(array( 'post_author' => $authorid, @@ -460,7 +461,7 @@ class Dotclear_Import { 'comment_approved' => $comment_approved) ); } - else + else { // Insert comments $ret_id = wp_insert_comment(array( @@ -547,7 +548,7 @@ class Dotclear_Import { return false; } - function import_categories() + function import_categories() { // Category Import $cats = $this->get_dc_cats(); @@ -565,7 +566,7 @@ class Dotclear_Import { function import_users() { // User Import - $users = $this->get_dc_users(); + $users = $this->get_dc_users(); $this->users2wp($users); echo '<form action="admin.php?import=dotclear&step=3" method="post">'; @@ -655,7 +656,7 @@ class Dotclear_Import { echo '</table>'; } - function dispatch() + function dispatch() { if (empty ($_GET['step'])) @@ -664,7 +665,7 @@ class Dotclear_Import { $step = (int) $_GET['step']; $this->header(); - if ( $step > 0 ) + if ( $step > 0 ) { if($_POST['dbuser']) { @@ -689,25 +690,25 @@ class Dotclear_Import { { if(get_option('dchost')) delete_option('dchost'); - add_option('dchost',$_POST['dbhost']); + add_option('dchost',$_POST['dbhost']); } if($_POST['dccharset']) { if(get_option('dccharset')) delete_option('dccharset'); - add_option('dccharset',$_POST['dccharset']); + add_option('dccharset',$_POST['dccharset']); } if($_POST['dbprefix']) { if(get_option('dcdbprefix')) delete_option('dcdbprefix'); - add_option('dcdbprefix',$_POST['dbprefix']); + add_option('dcdbprefix',$_POST['dbprefix']); } } - switch ($step) + switch ($step) { default: case 0 : @@ -736,7 +737,7 @@ class Dotclear_Import { $this->footer(); } - function Dotclear_Import() + function Dotclear_Import() { // Nothing. } diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php index 5494197..ea05ff2 100644 --- a/wp-admin/import/greymatter.php +++ b/wp-admin/import/greymatter.php @@ -66,10 +66,10 @@ class GM_Import { $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]; @@ -136,11 +136,11 @@ class GM_Import { <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) { @@ -194,7 +194,7 @@ class GM_Import { $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)'); @@ -303,7 +303,7 @@ class GM_Import { } function GM_Import() { - // Nothing. + // Nothing. } } diff --git a/wp-admin/import/mt.php b/wp-admin/import/mt.php index d484ba7..ffb869b 100644 --- a/wp-admin/import/mt.php +++ b/wp-admin/import/mt.php @@ -375,7 +375,7 @@ class MT_Import { function import() { $this->id = (int) $_GET['id']; - + $this->file = get_attached_file($this->id); $this->get_authors_from_post(); $this->get_entries(); diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php index e1a0339..435a588 100644 --- a/wp-admin/import/textpattern.php +++ b/wp-admin/import/textpattern.php @@ -4,7 +4,7 @@ **/ if(!function_exists('get_catbynicename')) { - function get_catbynicename($category_nicename) + function get_catbynicename($category_nicename) { global $wpdb; @@ -70,13 +70,13 @@ class Textpattern_Import { $prefix = get_option('tpre'); // Get Categories - return $txpdb->get_results('SELECT - id, - name, - title - FROM '.$prefix.'txp_category - WHERE type = "article"', - ARRAY_A); + return $txpdb->get_results('SELECT + id, + name, + title + FROM '.$prefix.'txp_category + WHERE type = "article"', + ARRAY_A); } function get_txp_users() @@ -90,12 +90,12 @@ class Textpattern_Import { // Get Users return $txpdb->get_results('SELECT - user_id, - name, - RealName, - email, - privs - FROM '.$prefix.'txp_users', ARRAY_A); + user_id, + name, + RealName, + email, + privs + FROM '.$prefix.'txp_users', ARRAY_A); } function get_txp_posts() @@ -106,22 +106,22 @@ class Textpattern_Import { $prefix = get_option('tpre'); // Get Posts - return $txpdb->get_results('SELECT - ID, - Posted, - AuthorID, - LastMod, - Title, - Body, - Excerpt, - Category1, - Category2, - Status, - Keywords, - url_title, - comments_count - FROM '.$prefix.'textpattern - ', ARRAY_A); + return $txpdb->get_results('SELECT + ID, + Posted, + AuthorID, + LastMod, + Title, + Body, + Excerpt, + Category1, + Category2, + Status, + Keywords, + url_title, + comments_count + FROM '.$prefix.'textpattern + ', ARRAY_A); } function get_txp_comments() @@ -143,18 +143,18 @@ class Textpattern_Import { set_magic_quotes_runtime(0); $prefix = get_option('tpre'); - return $txpdb->get_results('SELECT - id, - date, - category, - url, - linkname, - description - FROM '.$prefix.'txp_link', - ARRAY_A); + return $txpdb->get_results('SELECT + id, + date, + category, + url, + linkname, + description + FROM '.$prefix.'txp_link', + ARRAY_A); } - function cat2wp($categories='') + function cat2wp($categories='') { // General Housekeeping global $wpdb; @@ -164,7 +164,7 @@ class Textpattern_Import { if(is_array($categories)) { echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; - foreach ($categories as $category) + foreach ($categories as $category) { $count++; extract($category); @@ -226,7 +226,7 @@ class Textpattern_Import { 'display_name' => $name) ); } - else + else { $ret_id = wp_insert_user(array( 'user_login' => $name, @@ -302,35 +302,35 @@ class Textpattern_Import { if($pinfo = post_exists($Title,$Body)) { $ret_id = wp_insert_post(array( - 'ID' => $pinfo, - 'post_date' => $Posted, - 'post_date_gmt' => $post_date_gmt, - 'post_author' => $authorid, - 'post_modified' => $LastMod, - 'post_modified_gmt' => $post_modified_gmt, - 'post_title' => $Title, - 'post_content' => $Body, - 'post_excerpt' => $Excerpt, - 'post_status' => $post_status, - 'post_name' => $url_title, - 'comment_count' => $comments_count) - ); + 'ID' => $pinfo, + 'post_date' => $Posted, + 'post_date_gmt' => $post_date_gmt, + 'post_author' => $authorid, + 'post_modified' => $LastMod, + 'post_modified_gmt' => $post_modified_gmt, + 'post_title' => $Title, + 'post_content' => $Body, + 'post_excerpt' => $Excerpt, + 'post_status' => $post_status, + 'post_name' => $url_title, + 'comment_count' => $comments_count) + ); } - else + else { $ret_id = wp_insert_post(array( - 'post_date' => $Posted, - 'post_date_gmt' => $post_date_gmt, - 'post_author' => $authorid, - 'post_modified' => $LastMod, - 'post_modified_gmt' => $post_modified_gmt, - 'post_title' => $Title, - 'post_content' => $Body, - 'post_excerpt' => $Excerpt, - 'post_status' => $post_status, - 'post_name' => $url_title, - 'comment_count' => $comments_count) - ); + 'post_date' => $Posted, + 'post_date_gmt' => $post_date_gmt, + 'post_author' => $authorid, + 'post_modified' => $LastMod, + 'post_modified_gmt' => $post_modified_gmt, + 'post_title' => $Title, + 'post_content' => $Body, + 'post_excerpt' => $Excerpt, + 'post_status' => $post_status, + 'post_name' => $url_title, + 'comment_count' => $comments_count) + ); } $txpposts2wpposts[$ID] = $ret_id; @@ -379,29 +379,29 @@ class Textpattern_Import { { // Update comments $ret_id = wp_update_comment(array( - 'comment_ID' => $cinfo, - 'comment_post_ID' => $comment_post_ID, - 'comment_author' => $name, - 'comment_author_email' => $email, - 'comment_author_url' => $web, - 'comment_date' => $posted, - 'comment_content' => $message, - 'comment_approved' => $comment_approved) - ); + 'comment_ID' => $cinfo, + 'comment_post_ID' => $comment_post_ID, + 'comment_author' => $name, + 'comment_author_email' => $email, + 'comment_author_url' => $web, + 'comment_date' => $posted, + 'comment_content' => $message, + 'comment_approved' => $comment_approved) + ); } - else + 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' => $ip, - 'comment_date' => $posted, - 'comment_content' => $message, - 'comment_approved' => $comment_approved) - ); + 'comment_post_ID' => $comment_post_ID, + 'comment_author' => $name, + 'comment_author_email' => $email, + 'comment_author_url' => $web, + 'comment_author_IP' => $ip, + 'comment_date' => $posted, + 'comment_content' => $message, + 'comment_approved' => $comment_approved) + ); } $txpcm2wpcm[$comment_ID] = $ret_id; } @@ -450,7 +450,7 @@ class Textpattern_Import { 'link_updated' => $date) ); } - else + else { $ret_id = wp_insert_link(array( 'link_url' => $url, @@ -472,7 +472,7 @@ class Textpattern_Import { return false; } - function import_categories() + function import_categories() { // Category Import $cats = $this->get_txp_cats(); @@ -490,7 +490,7 @@ class Textpattern_Import { function import_users() { // User Import - $users = $this->get_txp_users(); + $users = $this->get_txp_users(); $this->users2wp($users); echo '<form action="admin.php?import=textpattern&step=3" method="post">'; @@ -578,7 +578,7 @@ class Textpattern_Import { echo '</table>'; } - function dispatch() + function dispatch() { if (empty ($_GET['step'])) @@ -587,7 +587,7 @@ class Textpattern_Import { $step = (int) $_GET['step']; $this->header(); - if ( $step > 0 ) + if ( $step > 0 ) { if($_POST['dbuser']) { @@ -612,19 +612,19 @@ class Textpattern_Import { { if(get_option('txphost')) delete_option('txphost'); - add_option('txphost',$_POST['dbhost']); + add_option('txphost',$_POST['dbhost']); } if($_POST['dbprefix']) { if(get_option('tpre')) delete_option('tpre'); - add_option('tpre',$_POST['dbprefix']); + add_option('tpre',$_POST['dbprefix']); } } - switch ($step) + switch ($step) { default: case 0 : @@ -653,7 +653,7 @@ class Textpattern_Import { $this->footer(); } - function Textpattern_Import() + function Textpattern_Import() { // Nothing. } diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index b850382..ac965b8 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -256,7 +256,7 @@ class WP_Import { function import() {
$this->id = (int) $_GET['id'];
-
+
$this->file = get_attached_file($this->id);
$this->get_authors_from_post();
$this->get_entries();
|