items) > 0) {
$content = "
\n";
foreach ($feed->items as $link) {
$publishdate = parse_w3cdtf($link['dc']['date']);
if ($publishdate >= $date) {
$must_post = true;
$content .= '- '
. ''
. htmlentities($link['title'])
. '';
if ($link['title'] != $link['description']) {
$content .= ' » '
. htmlentities($link['description']);
}
$content .= '
'
. "\n";
}
}
if ($del_showlink == true) {
$content .= "- Previous links
\n";
}
$content .= "
\n";
}
if($must_post) {
# Get Dates for Post
$now = current_time('mysql');
$now_gmt = current_time('mysql', 1);
# Build Query
$query = "INSERT INTO $tableposts "
. "(`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_status`, `comment_status`, `ping_status`, `post_name`, `post_modified`, `post_modified_gmt`) "
. "VALUES "
. "(" . $wp_userid . ", '" . $now . "', '" . $now_gmt . "', '" . addslashes($content) . "', '" . addslashes($wp_posttitle) . "', 'publish', '" . $wp_allowcomments . "', '" . $wp_allowpings . "', '" . $wp_postname . "', '" . $now . "', '" . $now_gmt . "');";
# Run Query
$wpdb->query($query);
# Get ID for category
$post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
# Build category query
$query = "INSERT INTO $tablepost2cat "
. "(`post_id`, `category_id`) "
. "VALUES "
. "('" . $post_ID . "', '" . $wp_catid . "');";
# Run Category Query
$wpdb->query($query);
} // must post
?>