function wp_insert_attachment($object, $file = false, $post_parent = 0) { global $wpdb, $user_ID; if ( is_object($object) ) $object = get_object_vars($object); // Export array as variables extract($object); // Get the basics. $post_content = apply_filters('content_save_pre', $post_content); $post_excerpt = apply_filters('excerpt_save_pre', $post_excerpt); $post_title = apply_filters('title_save_pre', $post_title); $post_category = apply_filters('category_save_pre', $post_category); $post_name = apply_filters('name_save_pre', $post_name); $comment_status = apply_filters('comment_status_pre', $comment_status); $ping_status = apply_filters('ping_status_pre', $ping_status); $post_mime_type = apply_filters('post_mime_type_pre', $post_mime_type); // Make sure we set a valid category if (0 == count($post_category) || !is_array($post_category)) { $post_category = array(get_option('default_category')); } $post_cat = $post_category[0]; if ( empty($post_author) ) $post_author = $user_ID; $post_status = 'attachment'; // Are we updating or creating? $update = false; if ( !empty($ID) ) { $update = true; $post_ID = $ID; } // Create a valid post name. if ( empty($post_name) ) $post_name = sanitize_title($post_title); else $post_name = sanitize_title($post_name); if (empty($post_date)) $post_date = current_time('mysql'); if (empty($post_date_gmt)) $post_date_gmt = current_time('mysql', 1); if ( empty($comment_status) ) { if ( $update ) $comment_status = 'closed'; else $comment_status = get_settings('default_comment_status'); } if ( empty($ping_status) ) $ping_status = get_settings('default_ping_status'); if ( empty($post_pingback) ) $post_pingback = get_option('default_pingback_flag'); if ( isset($to_ping) ) $to_ping = preg_replace('|\s+|', "\n", $to_ping); else $to_ping = ''; if ( isset($post_parent) ) $post_parent = (int) $post_parent; else $post_parent = 0; if ( isset($menu_order) ) $menu_order = (int) $menu_order; else $menu_order = 0; if ( !isset($post_password) ) $post_password = ''; if ( isset($to_ping) ) $to_ping = preg_replace('|\s+|', "\n", $to_ping); else $to_ping = ''; if ( ! isset($pinged) ) $pinged = ''; if ($update) { $wpdb->query( "UPDATE $wpdb->posts SET post_author = '$post_author', post_date = '$post_date', post_date_gmt = '$post_date_gmt', post_content = '$post_content', post_title = '$post_title', post_excerpt = '$post_excerpt', post_status = '$post_status', comment_status = '$comment_status', ping_status = '$ping_status', post_password = '******', post_name = '$post_name', to_ping = '$to_ping', pinged = '$pinged', post_modified = '".current_time('mysql')."', post_modified_gmt = '".current_time('mysql',1)."', post_parent = '$post_parent', menu_order = '$menu_order', post_mime_type = '$post_mime_type', guid = '$guid' WHERE ID = $post_ID"); } else { $wpdb->query( "INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); $post_ID = $wpdb->insert_id; } if ( empty($post_name) ) { $post_name = sanitize_title($post_title, $post_ID); $wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" ); } wp_set_post_cats('', $post_ID, $post_category); if ( $file ) add_post_meta($post_ID, '_wp_attached_file', $file); clean_post_cache($post_ID); if ( $update) { do_action('edit_attachment', $post_ID); } else { do_action('add_attachment', $post_ID); } return $post_ID; }
function mt_setPostCategories($params) { global $xmlrpcusererr; $xpostid = $params->getParam(0); $xuser = $params->getParam(1); $xpass = $params->getParam(2); $xcats = $params->getParam(3); $post_ID = $xpostid->scalarval(); $username = $xuser->scalarval(); $password = $xpass->scalarval(); $cats = xmlrpc_decode1($xcats); foreach ($cats as $cat) { $catids[] = $cat['categoryId']; } if (user_pass_ok($username, $password)) { wp_set_post_cats('', $post_ID, $catids); return new xmlrpcresp(new xmlrpcval($result, 'boolean')); } else { return new xmlrpcresp(0, $xmlrpcerruser + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password)); } }
function wp_create_categories($categories, $post_id = '') { $cat_ids = array(); foreach ($categories as $category) { if ($id = category_exists($category)) { $cat_ids[] = $id; } else { if ($id = wp_create_category($category)) { $cat_ids[] = $id; } } } if ($post_id) { wp_set_post_cats('', $post_id, $cat_ids); } return $cat_ids; }
/** * */ function wpadp_check_and_add_cats() { global $wpdb; $this->get_settings(); $expiration = $this->settings['PostAge']; $newCat = array($this->settings['AddCategory']); /* * Create a query that will give us all the post ID's that predate the * interval we are given, that is, NOW - expiration date. */ $query = "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'post' AND\n post_date < '{$date}' - INTERVAL " . $expiration . " DAY"; $ids = $wpdb->get_results($query); foreach ($ids as $id) { if ('' == $id->ID) { continue; } $curCat = wp_get_post_cats('', $id->ID); // Merge the contents of the newCat array with the curCat array, each of these can contain // multiple values $curCat = array_merge($curCat, $newCat); wp_set_post_cats('', $id->ID, $curCat); } }
function mt_setPostCategories($args) { $this->escape($args); $post_ID = $args[0]; $user_login = $args[1]; $user_pass = $args[2]; $categories = $args[3]; if (!$this->login_pass_ok($user_login, $user_pass)) { return $this->error; } $user = new WP_User(0, $user_login); if (!$user->has_cap('edit_post', $post_ID)) { return new IXR_Error(401, 'Sorry, you can not edit this post.'); } foreach ($categories as $cat) { $catids[] = $cat['categoryId']; } wp_set_post_cats('', $post_ID, $catids); return true; }
function posts2wp($posts = '') { // General Housekeeping global $wpdb; $count = 0; $dcposts2wpposts = array(); $cats = array(); // Do the Magic if (is_array($posts)) { echo '<p>' . __('Importing Posts...') . '<br /><br /></p>'; foreach ($posts as $post) { $count++; extract($post); // Set DotClear-to-WordPress status translation $stattrans = array(0 => 'draft', 1 => 'publish'); $comment_status_map = array(0 => 'closed', 1 => 'open'); //Can we do this more efficiently? $uinfo = get_userdatabylogin($user_id) ? get_userdatabylogin($user_id) : 1; $authorid = is_object($uinfo) ? $uinfo->ID : $uinfo; $Title = $wpdb->escape(csc($post_titre)); $post_content = textconv($post_content); $post_excerpt = ""; if ($post_chapo != "") { $post_excerpt = textconv($post_chapo); $post_content = $post_excerpt . "\n<!--more-->\n" . $post_content; } $post_excerpt = $wpdb->escape($post_excerpt); $post_content = $wpdb->escape($post_content); $post_status = $stattrans[$post_pub]; // Import Post data into WordPress if ($pinfo = post_exists($Title, $post_content)) { $ret_id = wp_insert_post(array('ID' => $pinfo, 'post_author' => $authorid, 'post_date' => $post_dt, 'post_date_gmt' => $post_dt, 'post_modified' => $post_upddt, 'post_modified_gmt' => $post_upddt, 'post_title' => $Title, 'post_content' => $post_content, 'post_excerpt' => $post_excerpt, 'post_status' => $post_status, 'post_name' => $post_titre_url, 'comment_status' => $comment_status_map[$post_open_comment], 'ping_status' => $comment_status_map[$post_open_tb], 'comment_count' => $post_nb_comment + $post_nb_trackback)); } else { $ret_id = wp_insert_post(array('post_author' => $authorid, 'post_date' => $post_dt, 'post_date_gmt' => $post_dt, 'post_modified' => $post_modified_gmt, 'post_modified_gmt' => $post_modified_gmt, 'post_title' => $Title, 'post_content' => $post_content, 'post_excerpt' => $post_excerpt, 'post_status' => $post_status, 'post_name' => $post_titre_url, 'comment_status' => $comment_status_map[$post_open_comment], 'ping_status' => $comment_status_map[$post_open_tb], 'comment_count' => $post_nb_comment + $post_nb_trackback)); } $dcposts2wpposts[$post_id] = $ret_id; // Make Post-to-Category associations $cats = array(); if ($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; } if (!empty($cats)) { wp_set_post_cats('', $ret_id, $cats); } } } // Store ID translation for later use add_option('dcposts2wpposts', $dcposts2wpposts); echo '<p>' . sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count) . '<br /><br /></p>'; return true; }
function insertPost() { global $wpdb, $wp_version, $csyn_last_effective_url; if ($this->show_report) { echo str_repeat(' ', 512); flush(); } if (mb_strlen(trim($this->post['post_content'])) == 0) { $this->post['post_content'] = $this->post['post_excerpt']; } $this->post['post_title'] = trim($this->post['post_title']); if (mb_strlen($this->post['post_title'])) { $cat_ids = $this->getCategoryIds($this->post['categories']); if (empty($cat_ids) && $this->current_feed['options']['undefined_category'] == 'drop') { return; } $post = array(); if (isset($this->post['tags_input']) && is_array($this->post['tags_input'])) { $post['tags_input'] = $this->post['tags_input']; } else { $post['tags_input'] = array(); } if (mb_strlen($this->post['guid']) < 8) { if (strlen($this->post['link'])) { $components = parse_url($this->post['link']); $guid = 'tag:' . $components['host']; } else { $guid = 'tag:' . md5($this->post['post_content'] . $this->post['post_excerpt']); } if ($this->post['post_date'] != "") { $guid .= '://post.' . $this->post['post_date']; } else { $guid .= '://' . md5($this->post['link'] . '/' . $this->post['post_title']); } } else { $guid = $this->post['guid']; } $post['post_title'] = csyn_fix_white_spaces($this->post['post_title']); $post['post_name'] = sanitize_title($post['post_title']); $post['guid'] = addslashes($guid); switch ($this->current_feed['options']['duplicate_check_method']) { case "guid": $result_dup = @$wpdb->query("SELECT ID FROM " . $wpdb->posts . " WHERE guid = \"" . $post['guid'] . "\""); break; case "title": $result_dup = @$wpdb->query("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = \"" . $post['post_name'] . "\""); break; default: $result_dup = @$wpdb->query("SELECT ID FROM " . $wpdb->posts . " WHERE guid = \"" . $post['guid'] . "\" OR post_name = \"" . $post['post_name'] . "\""); } if (!$result_dup) { if ($this->current_feed['options']['base_date'] == 'syndication') { $post_date = time(); } else { $post_date = (int) $this->post['post_date']; } $post_date += 60 * ($this->current_feed['options']['date_min'] + mt_rand(0, $this->current_feed['options']['date_max'] - $this->current_feed['options']['date_min'])); $post['post_date'] = addslashes(gmdate('Y-m-d H:i:s', $post_date + 3600 * (int) get_option('gmt_offset'))); $post['post_date_gmt'] = addslashes(gmdate('Y-m-d H:i:s', $post_date)); $post['post_modified'] = addslashes(gmdate('Y-m-d H:i:s', $post_date + 3600 * (int) get_option('gmt_offset'))); $post['post_modified_gmt'] = addslashes(gmdate('Y-m-d H:i:s', $post_date)); $post['post_status'] = $this->current_feed['options']['post_status']; $post['comment_status'] = $this->current_feed['options']['comment_status']; $post['ping_status'] = $this->current_feed['options']['ping_status']; $post['post_type'] = 'post'; $post['post_author'] = $this->current_feed['options']['post_author']; $attachment = ""; if ($this->current_feed['options']['insert_media_attachments'] != "no") { if (sizeof($this->post['media_thumbnail'])) { $attachment .= '<div class="media_block">' . "\n"; for ($i = 0; $i < sizeof($this->post['media_thumbnail']); $i++) { if ($this->current_feed['options']['store_images'] == 'on') { $this->post['media_thumbnail'][$i] = csyn_save_image($this->post['media_thumbnail'][$i], $post['post_title']); } if (isset($this->post['media_content'][$i])) { $attachment .= '<a href="' . $this->post['media_content'][$i] . '"><img src="' . $this->post['media_thumbnail'][$i] . '" class="media_thumbnail"></a>' . "\n"; } else { $attachment .= '<img src="' . $this->post['media_thumbnail'][$i] . '" class="media_thumbnail">' . "\n"; } } $attachment .= "</div>\n"; } if ($this->post['enclosure_url'] != "" && $this->post['link'] != "") { $attachment .= '<div class="media_block">' . "\n"; $attachment .= '<a href="' . $this->post['link'] . '"><img src="' . $this->post['enclosure_url'] . '" class="media_thumbnail"></a>' . "\n"; $attachment .= "</div>\n"; } } $attachment_status = $this->current_feed['options']['insert_media_attachments']; $post['post_content'] = $this->post['post_content']; $post['post_excerpt'] = $this->post['post_excerpt']; if ($this->current_feed['options']['embed_videos'] == 'on') { if (strpos($this->post['guid'], 'yt:video:') !== false) { list($yt, $video, $id) = explode(':', $this->post['guid']); $post['post_excerpt'] = $post['post_content'] = '<p><iframe class="embedded_video" width="560" height="315" src="http://www.youtube.com/embed/' . $id . '" frameborder="0" allowfullscreen></iframe></p>' . str_replace("\n", '<br />', htmlentities($this->post['media_description'], ENT_QUOTES, 'UTF-8')); } } if ($this->current_feed['options']['store_images'] == 'on') { preg_match_all('/<img(.+?)src=[\'\\"](.+?)[\'\\"](.*?)>/is', $post['post_content'] . $post['post_excerpt'], $matches); $image_urls = array_unique($matches[2]); $home = get_option('home'); for ($i = 0; $i < count($image_urls); $i++) { if (strpos($image_urls[$i], $home) === false) { $new_image_url = csyn_save_image($image_urls[$i], $post['post_title']); $post['post_content'] = str_replace($image_urls[$i], $new_image_url, $post['post_content']); $post['post_excerpt'] = str_replace($image_urls[$i], $new_image_url, $post['post_excerpt']); if ($this->show_report) { echo str_repeat(' ', 256); flush(); } } } } $inc_footerss = $this->current_feed['options']['include_post_footers']; $title = $post['post_title']; $content = csyn_fix_white_spaces($post['post_content']); $excerpt = csyn_fix_white_spaces($post['post_excerpt']); $post['post_title'] = addslashes($title); $post['post_content'] = addslashes(csyn_touch_post_content($content, $attachment, $attachment_status)); $post['post_excerpt'] = addslashes(csyn_touch_post_content($excerpt, $attachment, $attachment_status, $inc_footerss)); $post_categories = array(); if (is_array($this->current_feed['options']['post_category'])) { $post_categories = $this->current_feed['options']['post_category']; } if (!empty($cat_ids)) { $post_categories = array_merge($post_categories, $cat_ids); } elseif ($this->current_feed['options']['undefined_category'] == 'use_default' && empty($post_categories)) { $post_categories[] = get_option('default_category'); } $post_categories = array_unique($post_categories); $post['post_category'] = $post_categories; if ($this->current_feed['options']['create_tags'] == 'on') { $post['tags_input'] = array_merge($post['tags_input'], $this->post['categories']); } if ($this->current_feed['options']['post_tags'] != '') { $tags = explode(',', $this->current_feed['options']['post_tags']); $post['tags_input'] = array_merge($post['tags_input'], $tags); } $post['tags_input'] = array_unique($post['tags_input']); remove_filter('content_save_pre', 'wp_filter_post_kses'); remove_filter('excerpt_save_pre', 'wp_filter_post_kses'); $post_id = wp_insert_post($post, true); if (is_wp_error($post_id) && $this->show_report) { $this->failure = true; echo "<br /><b>Error:</b> " . $post_id->get_error_message($post_id->get_error_code()) . "<br />\n"; } else { $this->count++; $this->failure = false; add_post_meta($post_id, 'cyberseo_rss_source', $this->current_feed['url']); add_post_meta($post_id, 'cyberseo_post_link', $this->post['link']); if (version_compare($wp_version, '3.0', '<')) { if (function_exists('wp_set_post_categories')) { wp_set_post_categories($post_id, $post_categories); } elseif (function_exists('wp_set_post_cats')) { wp_set_post_cats('1', $post_id, $post_categories); } } } } } }
function posts2wp($posts='') { // General Housekeeping global $wpdb; $count = 0; $txpposts2wpposts = array(); $cats = array(); // Do the Magic if(is_array($posts)) { echo '<p>'.__('Importing Posts...').'<br /><br /></p>'; foreach($posts as $post) { $count++; extract($post); // Set Textpattern-to-WordPress status translation $stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish'); //Can we do this more efficiently? $uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1; $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ; $Title = $wpdb->escape($Title); $Body = $wpdb->escape($Body); $Excerpt = $wpdb->escape($Excerpt); $post_status = $stattrans[$Status]; // Import Post data into WordPress if($pinfo = post_exists($Title,$Body)) { $ret_id = wp_insert_post(array( 'ID' => $pinfo, 'post_date' => $Posted, 'post_date_gmt' => $post_date_gmt, 'post_author' => $authorid, 'post_modified' => $LastMod, 'post_modified_gmt' => $post_modified_gmt, 'post_title' => $Title, 'post_content' => $Body, 'post_excerpt' => $Excerpt, 'post_status' => $post_status, 'post_name' => $url_title, 'comment_count' => $comments_count) ); } else { $ret_id = wp_insert_post(array( 'post_date' => $Posted, 'post_date_gmt' => $post_date_gmt, 'post_author' => $authorid, 'post_modified' => $LastMod, 'post_modified_gmt' => $post_modified_gmt, 'post_title' => $Title, 'post_content' => $Body, 'post_excerpt' => $Excerpt, 'post_status' => $post_status, 'post_name' => $url_title, 'comment_count' => $comments_count) ); } $txpposts2wpposts[$ID] = $ret_id; // Make Post-to-Category associations $cats = array(); if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; } if($cat2 = get_catbynicename($Category2)) { $cats[2] = $cat2; } if(!empty($cats)) { wp_set_post_cats('', $ret_id, $cats); } } } // Store ID translation for later use add_option('txpposts2wpposts',$txpposts2wpposts); echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>'; return true; }
function wp_update_post($postarr = array()) { global $wpdb; // First get all of the original fields $post = wp_get_single_post($postarr['ID'], ARRAY_A); // Escape data pulled from DB. $post = add_magic_quotes($post); extract($post); // Now overwrite any changed values being passed in. These are // already escaped. extract($postarr); // If no categories were passed along, use the current cats. if (0 == count($post_category) || !is_array($post_category)) { $post_category = $post['post_category']; } $post_modified = current_time('mysql'); $post_modified_gmt = current_time('mysql', 1); $sql = "UPDATE {$wpdb->posts}\n\t\tSET post_content = '{$post_content}',\n\t\tpost_title = '{$post_title}',\n\t\tpost_category = {$post_category['0']},\n\t\tpost_status = '{$post_status}',\n\t\tpost_date = '{$post_date}',\n\t\tpost_date_gmt = '{$post_date_gmt}',\n\t\tpost_modified = '{$post_modified}',\n\t\tpost_modified_gmt = '{$post_modified_gmt}',\n\t\tpost_excerpt = '{$post_excerpt}',\n\t\tping_status = '{$ping_status}',\n\t\tcomment_status = '{$comment_status}'\n\t\tWHERE ID = {$ID}"; $result = $wpdb->query($sql); $rows_affected = $wpdb->rows_affected; wp_set_post_cats('', $ID, $post_category); do_action('edit_post', $ID); return $rows_affected; }
function wp_update_post($postarr = array()) { global $wpdb; // First get all of the original fields extract(wp_get_single_post($postarr['ID'], ARRAY_A)); // Now overwrite any changed values being passed in extract($postarr); // Make sure we set a valid category if ( 0 == count($post_category) || !is_array($post_category) ) $post_category = array($post_default_category); // Do some escapes for safety $post_title = $wpdb->escape($post_title); $post_excerpt = $wpdb->escape($post_excerpt); $post_content = $wpdb->escape($post_content); $post_modified = current_time('mysql'); $post_modified_gmt = current_time('mysql', 1); $sql = "UPDATE $wpdb->posts SET post_content = '$post_content', post_title = '$post_title', post_category = $post_category[0], post_status = '$post_status', post_date = '$post_date', post_date_gmt = '$post_date_gmt', post_modified = '$post_modified', post_modified_gmt = '$post_modified_gmt', post_excerpt = '$post_excerpt', ping_status = '$ping_status', comment_status = '$comment_status' WHERE ID = $ID"; $result = $wpdb->query($sql); $rows_affected = $wpdb->rows_affected; wp_set_post_cats('', $ID, $post_category); do_action('edit_post', $ID); return $rows_affected; }
function mt_setPostCategories($args) { $post_ID = $args[0]; $user_login = $args[1]; $user_pass = $args[2]; $categories = $args[3]; if (!$this->login_pass_ok($user_login, $user_pass)) { return $this->error; } $user_data = get_userdatabylogin($user_login); if (!user_can_edit_post($user_data->ID, $post_ID)) { return new IXR_Error(401, 'Sorry, you can not edit this post.'); } foreach($categories as $cat) { $catids[] = $cat['categoryId']; } wp_set_post_cats('', $post_ID, $catids); return true; }
function update_existing() { global $wpdb; // Why the f**k doesn't wp_insert_post already do this? $dbpost = array(); foreach ($this->post as $key => $value) { if (is_string($value)) { $dbpost[$key] = $wpdb->escape($value); } else { $dbpost[$key] = $value; } } if ($this->use_api('wp_insert_post')) { $dbpost['post_pingback'] = false; // Tell WP 2.1 and 2.2 not to process for pingbacks // This is a ridiculous f*****g kludge necessitated by WordPress 2.6 munging authorship meta-data add_action('_wp_put_post_revision', array($this, 'fix_revision_meta')); // Kludge to prevent kses filters from stripping the // content of posts when updating without a logged in // user who has `unfiltered_html` capability. add_filter('content_save_pre', array($this, 'avoid_kses_munge'), 11); $this->_wp_id = wp_insert_post($dbpost); // Turn off ridiculous f*****g kludges #1 and #2 remove_action('_wp_put_post_revision', array($this, 'fix_revision_meta')); remove_filter('content_save_pre', array($this, 'avoid_kses_munge'), 11); // This should never happen. if (!is_numeric($this->_wp_id) or $this->_wp_id == 0) { FeedWordPress::critical_bug('SyndicatedPost (_wp_id problem)', array("dbpost" => $dbpost, "this" => $this), __LINE__); } // Unfortunately, as of WordPress 2.3, wp_insert_post() // munges your post modified timestamp. $result = $wpdb->query("\n\t\t\t\tUPDATE {$wpdb->posts}\n\t\t\t\tSET\n\t\t\t\t\tpost_modified='{$dbpost['post_modified']}',\n\t\t\t\t\tpost_modified_gmt='{$dbpost['post_modified_gmt']}'\n\t\t\t\tWHERE ID='{$this->_wp_id}'\n\t\t\t"); } else { $result = $wpdb->query("\n\t\t\tUPDATE {$wpdb->posts}\n\t\t\tSET\n\t\t\t\tpost_author = '{$dbpost['post_author']}',\n\t\t\t\tpost_content = '{$dbpost['post_content']}'," . (isset($dbpost['post_excerpt']) ? "post_excerpt = '{$dbpost['post_excerpt']}'," : "") . "\n\t\t\t\tpost_title = '{$dbpost['post_title']}',\n\t\t\t\tpost_name = '{$dbpost['post_name']}',\n\t\t\t\tpost_modified = '{$dbpost['post_modified']}',\n\t\t\t\tpost_modified_gmt = '{$dbpost['post_modified_gmt']}'\n\t\t\tWHERE guid='{$dbpost['guid']}'\n\t\t\t"); // WordPress 2.1.x and up if (function_exists('wp_set_post_categories')) { wp_set_post_categories($this->wp_id(), $this->post['post_category']); // WordPress 1.5.x - 2.0.x } elseif (function_exists('wp_set_post_cats')) { wp_set_post_cats('1', $this->wp_id(), $this->post['post_category']); // This should never happen. } else { FeedWordPress::critical_bug('SyndicatedPost (_wp_id problem)', array("dbpost" => $dbpost, "this" => $this), __LINE__); } // Since we are not going through official channels, we need to // manually tell WordPress that we've published a new post. // We need to make sure to do this in order for FeedWordPress // to play well with the staticize-reloaded plugin (something // that a large aggregator website is going to *want* to be // able to use). do_action('edit_post', $this->post['ID']); } }