Update dotclear and textpattern importers to use taxonomy
git-svn-id: http://svn.automattic.com/wordpress/trunk@5953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
788512c881
commit
3d9dce3497
|
@ -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)
|
||||
|
@ -408,7 +387,10 @@ class Dotclear_Import {
|
|||
|
||||
// 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 +491,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));
|
||||
|
|
|
@ -2,18 +2,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'))
|
||||
{
|
||||
|
@ -338,8 +326,12 @@ class Textpattern_Import {
|
|||
|
||||
// Make Post-to-Category associations
|
||||
$cats = array();
|
||||
if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; }
|
||||
if($cat2 = get_catbynicename($Category2)) { $cats[2] = $cat2; }
|
||||
$category1 = get_category_by_slug($Category1);
|
||||
$category1 = $category1->term_id;
|
||||
$category2 = get_category_by_slug($Category2);
|
||||
$category2 = $category1->term_id;
|
||||
if($cat1 = $category1) { $cats[1] = $cat1; }
|
||||
if($cat2 = $category2) { $cats[2] = $cat2; }
|
||||
|
||||
if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue