summaryrefslogtreecommitdiffstats
path: root/wp-admin/import/dotclear.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-12 16:21:15 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-12 16:21:15 +0000
commit3a4570b0fc8b3d6339bef71d17d7701554e0bbf7 (patch)
tree2a06e5261263c68d8afd95a6328879dc289cb909 /wp-admin/import/dotclear.php
parentb83c34a7010faee0223f6037025c350da12e05e6 (diff)
downloadwordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.gz
wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.xz
wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.zip
Merge with WP 2.3 - testing use only!
Move pluggable functions out of wpmu-functions and into pluggable.php, fixes #439 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1069 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/import/dotclear.php')
-rw-r--r--wp-admin/import/dotclear.php53
1 files changed, 21 insertions, 32 deletions
diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php
index 661e1a0..1bf0486 100644
--- a/wp-admin/import/dotclear.php
+++ b/wp-admin/import/dotclear.php
@@ -7,18 +7,6 @@
/**
Add These Functions to make our lives easier
**/
-if(!function_exists('get_catbynicename'))
-{
- function get_catbynicename($category_nicename)
- {
- global $wpdb;
-
- $cat_id -= 0; // force numeric
- $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
-
- return $name;
- }
-}
if(!function_exists('get_comment_count'))
{
@@ -29,15 +17,6 @@ if(!function_exists('get_comment_count'))
}
}
-if(!function_exists('link_cat_exists'))
-{
- function link_cat_exists($catname)
- {
- global $wpdb;
- return $wpdb->get_var('SELECT cat_id FROM '.$wpdb->linkcategories.' WHERE cat_name = "'.$wpdb->escape($catname).'"');
- }
-}
-
if(!function_exists('link_exists'))
{
function link_exists($linkname)
@@ -130,19 +109,19 @@ function textconv ($s) {
**/
class Dotclear_Import {
- function header()
+ function header()
{
echo '<div class="wrap">';
echo '<h2>'.__('Import DotClear').'</h2>';
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
}
- function footer()
+ function footer()
{
echo '</div>';
}
- function greet()
+ function greet()
{
echo '<div class="narrow"><p>'.__('Howdy! This importer allows you to extract posts from a DotClear database into your blog. Mileage may vary.').'</p>';
echo '<p>'.__('Your DotClear Configuration settings are as follows:').'</p>';
@@ -385,6 +364,8 @@ class Dotclear_Import {
'ping_status' => $comment_status_map[$post_open_tb],
'comment_count' => $post_nb_comment + $post_nb_trackback)
);
+ if ( is_wp_error( $ret_id ) )
+ return $ret_id;
}
else
{
@@ -403,12 +384,17 @@ class Dotclear_Import {
'ping_status' => $comment_status_map[$post_open_tb],
'comment_count' => $post_nb_comment + $post_nb_trackback)
);
+ if ( is_wp_error( $ret_id ) )
+ return $ret_id;
}
$dcposts2wpposts[$post_id] = $ret_id;
// Make Post-to-Category associations
$cats = array();
- if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; }
+ $category1 = get_category_by_slug($post_cat_name);
+ $category1 = $category1->term_id;
+
+ if($cat1 = $category1) { $cats[1] = $cat1; }
if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
}
@@ -509,12 +495,11 @@ class Dotclear_Import {
extract($link);
if ($title != "") {
- if ($cinfo = link_cat_exists (csc ($title))) {
- $category = $cinfo;
+ if ($cinfo = is_term(csc ($title), 'link_category')) {
+ $category = $cinfo['term_id'];
} else {
- $wpdb->query ("INSERT INTO $wpdb->linkcategories (cat_name) VALUES ('".
- $wpdb->escape (csc ($title))."')");
- $category = $wpdb->insert_id;
+ $category = wp_insert_term($wpdb->escape (csc ($title)), 'link_category');
+ $category = $category['term_id'];
}
} else {
$linkname = $wpdb->escape(csc ($label));
@@ -581,7 +566,9 @@ class Dotclear_Import {
{
// Post Import
$posts = $this->get_dc_posts();
- $this->posts2wp($posts);
+ $result = $this->posts2wp($posts);
+ if ( is_wp_error( $result ) )
+ return $result;
echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
wp_nonce_field('import-dotclear');
@@ -729,7 +716,9 @@ class Dotclear_Import {
$this->import_users();
break;
case 3 :
- $this->import_posts();
+ $result = $this->import_posts();
+ if ( is_wp_error( $result ) )
+ echo $result->get_error_message();
break;
case 4 :
$this->import_comments();