summaryrefslogtreecommitdiffstats
path: root/wp-admin/import
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-11-30 18:54:22 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-11-30 18:54:22 +0000
commit9415bbca12c01c39da58e0ed2c4e6b44ff833e5d (patch)
tree72e6c3da0cf5b18f808b7b5002ffd41f3edc0904 /wp-admin/import
parent475ef251608d4d8a4d44a86d99693c416a1159fd (diff)
downloadwordpress-mu-9415bbca12c01c39da58e0ed2c4e6b44ff833e5d.tar.gz
wordpress-mu-9415bbca12c01c39da58e0ed2c4e6b44ff833e5d.tar.xz
wordpress-mu-9415bbca12c01c39da58e0ed2c4e6b44ff833e5d.zip
WP Merge to 4559
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@816 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/import')
-rw-r--r--wp-admin/import/blogger.php8
-rw-r--r--wp-admin/import/wordpress.php34
2 files changed, 37 insertions, 5 deletions
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php
index d7df5ad..060a5e9 100644
--- a/wp-admin/import/blogger.php
+++ b/wp-admin/import/blogger.php
@@ -10,7 +10,7 @@ class Blogger_Import {
$title = __('Import Blogger');
$welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.');
$noiframes = __('This feature requires iframe support.');
- $warning = __('This will delete everything saved by the Blogger importer except your posts and comments. Are you sure you want to do this?');
+ $warning = js_escape(__('This will delete everything saved by the Blogger importer except your posts and comments. Are you sure you want to do this?'));
$reset = __('Reset this importer');
$incompat = __('Your web server is not properly configured to use this importer. Please enable the CURL extension for PHP and then reload this page.');
@@ -255,7 +255,7 @@ class Blogger_Import {
'blog-options-basic' => false,
'blog-options-archiving' => array('archiveFrequency' => 'm'),
'blog-publishing' => array('publishMode'=>'0', 'blogID' => "$id", 'subdomain' => mt_rand().mt_rand(), 'pingWeblogs' => 'false'),
- 'blog-formatting' => array('timeStampFormat' => '0', 'convertLineBreaks'=>'false', 'floatAlignment'=>'false'),
+ 'blog-formatting' => array('timeStampFormat' => '0', 'encoding'=>'UTF-8', 'convertLineBreaks'=>'false', 'floatAlignment'=>'false'),
'blog-comments' => array('commentsTimeStampFormat' => '0'),
'template-edit' => array( 'templateText' => str_replace('%title%', trim($blogsary[2][$key]), $template) )
);
@@ -349,7 +349,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";
}
@@ -428,7 +428,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 );
diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php
index ac965b8..109d0a7 100644
--- a/wp-admin/import/wordpress.php
+++ b/wp-admin/import/wordpress.php
@@ -69,6 +69,8 @@ class WP_Import {
$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
preg_match_all('|<item>(.*?)</item>|is', $importdata, $this->posts);
$this->posts = $this->posts[1];
+ preg_match_all('|<wp:category>(.*?)</wp:category>|is', $importdata, $this->categories);
+ $this->categories = $this->categories[1];
}
function get_wp_authors() {
@@ -160,6 +162,35 @@ class WP_Import {
$this->wp_authors_form();
}
+ function process_categories() {
+ global $wpdb;
+
+ $cat_names = (array) $wpdb->get_col("SELECT cat_name FROM $wpdb->categories");
+
+ while ( $c = array_shift($this->categories) ) {
+ $cat_name = trim(str_replace(array ('<![CDATA[', ']]>'), '', $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' );
+ $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 = (int) category_exists($parent);
+
+ $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name');
+
+ $cat_ID = wp_insert_category($catarr);
+ }
+ }
+
function process_posts() {
global $wpdb;
$i = -1;
@@ -189,7 +220,7 @@ class WP_Import {
$cat_index = 0;
foreach ($categories as $category) {
- $categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
+ $categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category)));
$cat_index++;
}
@@ -260,6 +291,7 @@ class WP_Import {
$this->file = get_attached_file($this->id);
$this->get_authors_from_post();
$this->get_entries();
+ $this->process_categories();
$this->process_posts();
}