function add_rss_meta($new_status, $old_status, $post)
{
global $wpdb;
if ($new_status != 'inherit') {
// Bail if we are creating a revision.
FeedWordPress::diagnostic('syndicated_posts:meta_data', 'Adding post meta-data: {' . implode(", ", array_keys($this->post['meta'])) . '}');
if (is_array($this->post) and isset($this->post['meta']) and is_array($this->post['meta'])) {
$postId = $post->ID;
// Aggregated posts should NOT send out pingbacks.
// WordPress 2.1-2.2 claim you can tell them not to
// using $post_pingback, but they don't listen, so we
// make sure here.
$result = $wpdb->query("\n\t\t\t\tDELETE FROM {$wpdb->postmeta}\n\t\t\t\tWHERE post_id='{$postId}' AND meta_key='_pingme'\n\t\t\t\t");
foreach ($this->post['meta'] as $key => $values) {
$eKey = esc_sql($key);
// If this is an update, clear out the old
// values to avoid duplication.
$result = $wpdb->query("\n\t\t\t\t\tDELETE FROM {$wpdb->postmeta}\n\t\t\t\t\tWHERE post_id='{$postId}' AND meta_key='{$eKey}'\n\t\t\t\t\t");
// Allow for either a single value or an array
if (!is_array($values)) {
$values = array($values);
}
foreach ($values as $value) {
FeedWordPress::diagnostic('syndicated_posts:meta_data', "Adding post meta-datum to post [{$postId}]: [{$key}] = " . MyPHP::val($value, true));
add_post_meta($postId, $key, $value, false);
}
}
}
}
}