term_id] = $category->parent;
$parents = array_unique(array_diff($parents, array_keys($parents)));
if ( $zero = array_search('0', $parents) )
unset($parents[$zero]);
return $parents;
}
/**
* Place string in CDATA tag.
*
* @since unknown
*
* @param string $str String to place in XML CDATA tag.
*/
function hc_export_wxr_cdata($str) {
if ( seems_utf8($str) == false )
$str = utf8_encode($str);
// $str = ent2ncr(esc_html($str));
$str = "";
return $str;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return string Site URL.
*/
function hc_export_wxr_site_url() {
global $current_site;
// mu: the base url
if ( isset($current_site->domain) ) {
return 'http://'.$current_site->domain.$current_site->path;
}
// wp: the blog url
else {
return get_bloginfo_rss('url');
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param object $c Category Object
*/
function hc_export_wxr_cat_name($c) {
if ( empty($c->name) )
return;
echo '' . dsq_export_wxr_cdata($c->name) . '';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param object $c Category Object
*/
function hc_export_wxr_category_description($c) {
if ( empty($c->description) )
return;
echo '' . dsq_export_wxr_cdata($c->description) . '';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param object $t Tag Object
*/
function hc_export_wxr_tag_name($t) {
if ( empty($t->name) )
return;
echo '' . dsq_export_wxr_cdata($t->name) . '';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param object $t Tag Object
*/
function hc_export_wxr_tag_description($t) {
if ( empty($t->description) )
return;
echo '' . dsq_export_wxr_cdata($t->description) . '';
}
// receives an array of posts to export
function hc_export_wp($comments=null) {
global $wpdb;
?>
';
?>
WordPress
in_the_loop = true; // Fake being in the loop.
setup_postdata($post);
$post = $wpdb->get_results($wpdb->prepare("
SELECT * FROM $wpdb->posts WHERE post_type != 'revision' AND post_status = 'publish' AND comment_count > 0"));
//global $wp_query, $post;
// start catching output
if ( $post ) { foreach ( $post as $p ) {
?>
-
post_title); ?>
guid); echo str_replace($parse['scheme'].'://'.$parse['host'], get_option('home'), $p->guid) ?>
guid; ?>
post_content) ); ?>
ID . ' ' . $p->guid; ?>
ID; ?>
post_date_gmt; ?>
comment_status; ?>
comments WHERE comment_post_ID=".$p->ID ;
$comments = $wpdb->get_results( $wpdb->prepare( $commentQ));
if ( $comments ) { foreach ( $comments as $c ) { ?>
comment_ID; ?>
comment_author); ?>
comment_author_email; ?>
comment_author_url; ?>
comment_author_IP; ?>
comment_date; ?>
comment_date_gmt; ?>
comment_content)) ?>
comment_approved; ?>
comment_type; ?>
comment_parent; ?>