critical_bug() static public méthode

# Internal debugging functions
static public critical_bug ( $varname, $var, $line, $file = NULL )
 function updates_requested()
 {
     if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) {
         // Only do things with side-effects for HTTP POST or command line
         $fwp_update_invoke = 'post';
     } else {
         $fwp_update_invoke = 'get';
     }
     $update_set = array();
     if ($fwp_update_invoke != 'get') {
         if (isset($_POST['link_ids']) and is_array($_POST['link_ids']) and $_POST['action'] == FWP_UPDATE_CHECKED) {
             $targets = get_bookmarks(array('include' => implode(",", $_POST['link_ids'])));
             if (is_array($targets)) {
                 foreach ($targets as $target) {
                     $update_set[] = $target->link_rss;
                 }
             } else {
                 // This should never happen
                 FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__);
             }
         } elseif (isset($_POST['update_uri'])) {
             $targets = $_POST['update_uri'];
             if (!is_array($targets)) {
                 $targets = array($targets);
             }
             $update_set = $targets;
         }
     }
     return $update_set;
 }
 function updates_requested()
 {
     global $wpdb;
     if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) {
         // Only do things with side-effects for HTTP POST or command line
         $fwp_update_invoke = 'post';
     } else {
         $fwp_update_invoke = 'get';
     }
     $update_set = array();
     if ($fwp_update_invoke != 'get') {
         if (is_array(MyPHP::post('link_ids')) and MyPHP::post('action') == FWP_UPDATE_CHECKED) {
             $targets = $wpdb->get_results("\n\t\t\t\tSELECT * FROM {$wpdb->links}\n\t\t\t\tWHERE link_id IN (" . implode(",", $_POST['link_ids']) . ")\n\t\t\t\t");
             if (is_array($targets)) {
                 foreach ($targets as $target) {
                     $update_set[] = $target->link_rss;
                 }
             } else {
                 // This should never happen
                 FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__, __FILE__);
             }
         } elseif (!is_null(MyPHP::post('update_uri'))) {
             $targets = MyPHP::post('update_uri');
             if (!is_array($targets)) {
                 $targets = array($targets);
             }
             $first = each($targets);
             if (!is_numeric($first['key'])) {
                 // URLs in keys
                 $targets = array_keys($targets);
             }
             $update_set = $targets;
         }
     }
     return $update_set;
 }
 function store()
 {
     global $wpdb;
     if ($this->filtered()) {
         // This should never happen.
         FeedWordPress::critical_bug('SyndicatedPost', $this, __LINE__, __FILE__);
     }
     $freshness = $this->freshness();
     if ($this->has_fresh_content()) {
         # -- Look up, or create, numeric ID for author
         $this->post['post_author'] = $this->author_id($this->link->setting('unfamiliar author', 'unfamiliar_author', 'create'));
         if (is_null($this->post['post_author'])) {
             FeedWordPress::diagnostic('feed_items:rejected', 'Filtered out item [' . $this->guid() . '] without syndication: no author available');
             $this->post = NULL;
         }
     }
     // We have to check again in case post has been filtered during
     // the author_id lookup
     if ($this->has_fresh_content()) {
         $consider = array('category' => array('abbr' => 'cats', 'domain' => array('category', 'post_tag')), 'post_tag' => array('abbr' => 'tags', 'domain' => array('post_tag')));
         $termSet = array();
         $valid = null;
         foreach ($consider as $what => $taxes) {
             if (!is_null($this->post)) {
                 // Not filtered out yet
                 # -- Look up, or create, numeric ID for categories
                 $taxonomies = $this->link->setting("match/" . $taxes['abbr'], 'match_' . $taxes['abbr'], $taxes['domain']);
                 // Eliminate dummy variables
                 $taxonomies = array_filter($taxonomies, 'remove_dummy_zero');
                 $terms = $this->category_ids($this->feed_terms[$what], $this->link->setting("unfamiliar {$what}", "unfamiliar_{$what}", 'create:' . $what), $taxonomies, array('singleton' => false, 'filters' => true));
                 if (is_null($terms) or is_null($termSet)) {
                     // filtered out -- no matches
                 } else {
                     $valid = true;
                     // filter mode off, or at least one match
                     foreach ($terms as $tax => $term_ids) {
                         if (!isset($termSet[$tax])) {
                             $termSet[$tax] = array();
                         }
                         $termSet[$tax] = array_merge($termSet[$tax], $term_ids);
                     }
                 }
             }
         }
         if (is_null($valid)) {
             // Plonked
             $this->post = NULL;
         } else {
             // We can proceed
             $this->post['tax_input'] = array();
             foreach ($termSet as $tax => $term_ids) {
                 if (!isset($this->post['tax_input'][$tax])) {
                     $this->post['tax_input'][$tax] = array();
                 }
                 $this->post['tax_input'][$tax] = array_merge($this->post['tax_input'][$tax], $term_ids);
             }
             // Now let's add on the feed and global presets
             foreach ($this->preset_terms as $tax => $term_ids) {
                 if (!isset($this->post['tax_input'][$tax])) {
                     $this->post['tax_input'][$tax] = array();
                 }
                 $this->post['tax_input'][$tax] = array_merge($this->post['tax_input'][$tax], $this->category_ids($term_ids, 'create:' . $tax, array($tax), array('singleton' => true)));
             }
         }
     }
     // We have to check again in case the post has been filtered
     // during the category/tags/taxonomy terms lookup
     if ($this->has_fresh_content()) {
         // Filter some individual fields
         // If there already is a post slug (from syndication or by manual
         // editing) don't cause WP to overwrite it by sending in a NULL
         // post_name. Props Chris Fritz 2012-11-28.
         $post_name = is_null($this->_wp_post) ? NULL : $this->_wp_post->post_name;
         // Allow filters to set post slug. Props niska.
         $post_name = apply_filters('syndicated_post_slug', $post_name, $this);
         if (!empty($post_name)) {
             $this->post['post_name'] = $post_name;
         }
         $this->post = apply_filters('syndicated_post', $this->post, $this);
         // Allow for feed-specific syndicated_post filters.
         $this->post = apply_filters("syndicated_post_" . $this->link->uri(), $this->post, $this);
     }
     // Hook in early to make sure these get inserted if at all possible
     add_action('transition_post_status', array($this, 'add_rss_meta'), -10000, 3);
     $ret = false;
     if ($this->has_fresh_content()) {
         $diag = $this->fresh_storage_diagnostic();
         if (!is_null($diag)) {
             FeedWordPress::diagnostic('syndicated_posts', $diag);
         }
         $this->insert_post($this->fresh_content_is_update(), $this->freshness());
         $hook = $this->fresh_storage_hook();
         if (!is_null($hook)) {
             do_action($hook, $this->wp_id(), $this);
         }
         $ret = $this->freshness('status');
     }
     // If this is a legit, non-filtered post, tag it as found on the
     // feed regardless of fresh or stale status
     if (!$this->filtered()) {
         $key = '_feedwordpress_retire_me_' . $this->link->id;
         delete_post_meta($this->wp_id(), $key);
         $status = get_post_field('post_status', $this->wp_id());
         if ('fwpretired' == $status and $this->link->is_non_incremental()) {
             FeedWordPress::diagnostic('syndicated_posts', "Un-retiring previously retired post # " . $this->wp_id() . " due to re-appearance on non-incremental feed.");
             set_post_field('post_status', $this->post['post_status'], $this->wp_id());
             wp_transition_post_status($this->post['post_status'], $status, $this->post);
         } elseif ('fwpzapped' == $status) {
             // Set this new revision up to be
             // blanked on the next update.
             add_post_meta($this->wp_id(), '_feedwordpress_zapped_blank_me', 2, true);
         }
     }
     // Remove add_rss_meta hook
     remove_action('transition_post_status', array($this, 'add_rss_meta'), -10000, 3);
     return $ret;
 }
 function updates_requested()
 {
     global $wpdb;
     if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) {
         // Only do things with side-effects for HTTP POST or command line
         $fwp_update_invoke = 'post';
     } else {
         $fwp_update_invoke = 'get';
     }
     $update_set = array();
     if ($fwp_update_invoke != 'get') {
         if (is_array(MyPHP::post('link_ids')) and MyPHP::post('action') == FWP_UPDATE_CHECKED) {
             // Get single link ID or multiple link IDs from REQUEST parameters
             // if available. Sanitize values for MySQL.
             $link_list = $this->requested_link_ids_sql();
             // $link_list has previously been sanitized for html by self::requested_link_ids_sql
             $targets = $wpdb->get_results("\n\t\t\t\tSELECT * FROM {$wpdb->links}\n\t\t\t\tWHERE link_id IN {$link_list}\n\t\t\t\t");
             if (is_array($targets)) {
                 foreach ($targets as $target) {
                     $update_set[] = $target->link_rss;
                 }
             } else {
                 // This should never happen
                 FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__, __FILE__);
             }
         } elseif (!is_null(MyPHP::post('update_uri'))) {
             $targets = MyPHP::post('update_uri');
             if (!is_array($targets)) {
                 $targets = array($targets);
             }
             $first = each($targets);
             if (!is_numeric($first['key'])) {
                 // URLs in keys
                 $targets = array_keys($targets);
             }
             $update_set = $targets;
         }
     }
     return $update_set;
 }
 function noncritical_bug($varname, $var, $line, $file = NULL)
 {
     if (FEEDWORDPRESS_DEBUG) {
         // halt only when we are doing debugging
         FeedWordPress::critical_bug($varname, $var, $line, $file);
     }
 }
 function stale()
 {
     /* CF: We have to be logged into the wp-admin to be able to insert
     		posts with the standard WP functions (e.g., wp_insert_post(), etc.)
     		So if we're not in the admin, then just say we're good to wait till
     		someone is....then the post retrieval and creation will happen.  
     		This type of check will also be placed in the syndicatedlink.class.php 
     		stale() method */
     if (!is_admin()) {
         return false;
     }
     if (get_option('feedwordpress_automatic_updates')) {
         // Do our best to avoid possible simultaneous
         // updates by getting up-to-the-minute settings.
         $last = get_option('feedwordpress_last_update_all');
         // If we haven't updated all yet, give it a time window
         if (false === $last) {
             $ret = false;
             update_option('feedwordpress_last_update_all', time());
             // Otherwise, check against freshness interval
         } elseif (is_numeric($last)) {
             // Expect a timestamp
             $freshness = get_option('feedwordpress_freshness');
             if (false === $freshness) {
                 // Use default
                 $freshness = FEEDWORDPRESS_FRESHNESS_INTERVAL;
             }
             $ret = time() - $last > $freshness;
             // This should never happen.
         } else {
             FeedWordPress::critical_bug('FeedWordPress::stale::last', $last, __LINE__);
         }
     } else {
         $ret = false;
     }
     return $ret;
 }
 /**
  * SyndicatedPost::validate_post_id()
  *
  * @param array $dbpost An array representing the post we attempted to insert or update
  * @param mixed $ns A string or array representing the namespace (class, method) whence this method was called.
  */
 function validate_post_id($dbpost, $ns)
 {
     if (is_array($ns)) {
         $ns = implode('::', $ns);
     } else {
         $ns = (string) $ns;
     }
     // This should never happen.
     if (!is_numeric($this->_wp_id) or $this->_wp_id == 0) {
         FeedWordPress::critical_bug($ns . '::_wp_id', array("\$this->_wp_id" => $this->_wp_id, "\$dbpost" => $dbpost, "\$this" => $this), __LINE__);
     }
 }
function fwp_feedfinder_page()
{
    global $wpdb;
    $lookup = isset($_REQUEST['lookup']) ? $_REQUEST['lookup'] : NULL;
    if (isset($_REQUEST['link_id']) and $_REQUEST['link_id'] != 0) {
        $link_id = $_REQUEST['link_id'];
        if (!is_numeric($link_id)) {
            FeedWordPress::critical_bug('fwp_feedfinder_page::link_id', $link_id, __LINE__);
        }
        $link = $wpdb->get_row("SELECT * FROM {$wpdb->links} WHERE link_id='" . $wpdb->escape($link_id) . "'");
        if (is_object($link)) {
            if (is_null($lookup)) {
                $lookup = $link->link_url;
            }
            $name = wp_specialchars($link->link_name, 'both');
        } else {
            die(__("Cheatin' uh ?"));
        }
    } else {
        $name = "<code>" . htmlspecialchars($lookup) . "</code>";
        $link_id = 0;
    }
    ?>
	<div class="wrap">
	<h2>Feed Finder: <?php 
    echo $name;
    ?>
</h2>
<?php 
    $f =& new FeedFinder($lookup);
    $feeds = $f->find();
    if (count($feeds) > 0) {
        foreach ($feeds as $key => $f) {
            $rss = fetch_rss($f);
            if ($rss) {
                $feed_title = isset($rss->channel['title']) ? $rss->channel['title'] : $rss->channel['link'];
                $feed_link = isset($rss->channel['link']) ? $rss->channel['link'] : '';
            } else {
                // Give us some sucky defaults
                $uri_bits = parse_url($lookup);
                $uri_bits['host'] = preg_replace('/^www\\./i', '', $uri_bits['host']);
                $display_uri = (isset($uri_bits['user']) ? $uri_bits['user'] . '@' : '') . (isset($uri_bits['host']) ? $uri_bits['host'] : '') . (isset($uri_bits['port']) ? ':' . $uri_bits['port'] : '') . (isset($uri_bits['path']) ? $uri_bits['path'] : '') . (isset($uri_bits['query']) ? '?' . $uri_bits['query'] : '');
                if (strlen($display_uri) > 32) {
                    $display_uri = substr($display_uri, 0, 32) . '&#8230;';
                }
                $feed_title = $display_uri;
                $feed_link = $lookup;
            }
            ?>
				<form action="admin.php?page=<?php 
            print $GLOBALS['fwp_path'];
            ?>
/<?php 
            echo basename(__FILE__);
            ?>
" method="post">
				<fieldset style="clear: both">
				<legend><?php 
            echo $rss->feed_type;
            ?>
 <?php 
            echo $rss->feed_version;
            ?>
 feed</legend>

				<?php 
            if ($link_id === 0) {
                ?>
					<input type="hidden" name="feed_title" value="<?php 
                echo wp_specialchars($feed_title, 'both');
                ?>
" />
					<input type="hidden" name="feed_link" value="<?php 
                echo wp_specialchars($feed_link, 'both');
                ?>
" />
				<?php 
            }
            ?>

				<input type="hidden" name="link_id" value="<?php 
            echo $link_id;
            ?>
" />
				<input type="hidden" name="feed" value="<?php 
            echo wp_specialchars($f, 'both');
            ?>
" />
				<input type="hidden" name="action" value="switchfeed" />

				<div>
				<div style="float:right; background-color:#D0D0D0; color: black; width:45%; font-size:70%; border-left: 1px dotted #A0A0A0; padding-left: 0.5em; margin-left: 1.0em">
<?php 
            if (count($rss->items) > 0) {
                ?>
					<?php 
                $item = $rss->items[0];
                ?>
					<h3>Sample Item</h3>
					<ul>
					<li><strong>Title:</strong> <a href="<?php 
                echo $item['link'];
                ?>
"><?php 
                echo $item['title'];
                ?>
</a></li>
					<li><strong>Date:</strong> <?php 
                echo isset($item['date_timestamp']) ? date('d-M-y g:i:s a', $item['date_timestamp']) : 'unknown';
                ?>
</li>
					</ul>
					<div class="entry">
					<?php 
                echo isset($item['content']['encoded']) ? $item['content']['encoded'] : $item['description'];
                ?>
					</div>
<?php 
            } else {
                ?>
					<h3>No Items</h3>
					<p>FeedWordPress found no posts on this feed.</p>
<?php 
            }
            ?>
				</div>

				<div>
				<h3>Feed Information</h3>
				<ul>
				<li><strong>Website:</strong> <a href="<?php 
            echo $feed_link;
            ?>
"><?php 
            echo is_null($feed_title) ? '<em>Unknown</em>' : $feed_title;
            ?>
</a></li>
				<li><strong>Feed URI:</strong> <a href="<?php 
            echo wp_specialchars($f, 'both');
            ?>
"><?php 
            echo wp_specialchars($f, 'both');
            ?>
</a> (<a title="Check feed &lt;<?php 
            echo wp_specialchars($f, 'both');
            ?>
&gt; for validity" href="http://feedvalidator.org/check.cgi?url=<?php 
            echo urlencode($f);
            ?>
">validate</a>)</li>
				<li><strong>Encoding:</strong> <?php 
            echo isset($rss->encoding) ? wp_specialchars($rss->encoding, 'both') : "<em>Unknown</em>";
            ?>
</li>
				<li><strong>Description:</strong> <?php 
            echo isset($rss->channel['description']) ? wp_specialchars($rss->channel['description'], 'both') : "<em>Unknown</em>";
            ?>
</li>
				</ul>
				<div class="submit"><input type="submit" name="Use" value="&laquo; Use this feed" /></div>
				<div class="submit"><input type="submit" name="Cancel" value="&laquo; Cancel" /></div>
				</div>
				</div>
				</fieldset>
				</form>
<?php 
        }
    } else {
        print "<p><strong>" . __('Error') . ":</strong> " . __("I couldn't find any feeds at") . ' <code><a href="' . htmlspecialchars($lookup) . '">' . htmlspecialchars($lookup) . '</a></code>';
        if (!is_null($f->error())) {
            print " [" . __('HTTP request error') . ": " . htmlspecialchars(trim($f->error())) . "]";
        }
        print ". " . __('Try another URL') . "</p>";
    }
    ?>
	</div>

	<form action="admin.php?page=<?php 
    print $GLOBALS['fwp_path'];
    ?>
/<?php 
    echo basename(__FILE__);
    ?>
" method="post">
	<div class="wrap">
	<h2>Use another feed</h2>
	<div><label>Feed:</label>
	<input type="text" name="lookup" value="URI" />
	<input type="hidden" name="link_id" value="<?php 
    echo $link_id;
    ?>
" />
	<input type="hidden" name="action" value="feedfinder" /></div>
	<div class="submit"><input type="submit" value="Use this feed &raquo;" /></div>
	</div>
	</form>
<?php 
    return false;
    // Don't continue
}
 function store()
 {
     global $wpdb;
     if ($this->filtered()) {
         // This should never happen.
         FeedWordPress::critical_bug('SyndicatedPost', $this, __LINE__, __FILE__);
     }
     $freshness = $this->freshness();
     if ($freshness > 0) {
         # -- Look up, or create, numeric ID for author
         $this->post['post_author'] = $this->author_id($this->link->setting('unfamiliar author', 'unfamiliar_author', 'create'));
         if (is_null($this->post['post_author'])) {
             FeedWordPress::diagnostic('feed_items:rejected', 'Filtered out item [' . $this->guid() . '] without syndication: no author available');
             $this->post = NULL;
         }
     }
     if (!$this->filtered() and $freshness > 0) {
         $consider = array('category' => array('abbr' => 'cats', 'domain' => array('category', 'post_tag')), 'post_tag' => array('abbr' => 'tags', 'domain' => array('post_tag')));
         $termSet = array();
         $valid = null;
         foreach ($consider as $what => $taxes) {
             if (!is_null($this->post)) {
                 // Not filtered out yet
                 # -- Look up, or create, numeric ID for categories
                 $taxonomies = $this->link->setting("match/" . $taxes['abbr'], 'match_' . $taxes['abbr'], $taxes['domain']);
                 // Eliminate dummy variables
                 $taxonomies = array_filter($taxonomies, 'remove_dummy_zero');
                 $terms = $this->category_ids($this->feed_terms[$what], $this->link->setting("unfamiliar {$what}", "unfamiliar_{$what}", 'create:' . $what), $taxonomies, array('singleton' => false, 'filters' => true));
                 if (is_null($terms) or is_null($termSet)) {
                     // filtered out -- no matches
                 } else {
                     $valid = true;
                     // filter mode off, or at least one match
                     foreach ($terms as $tax => $term_ids) {
                         if (!isset($termSet[$tax])) {
                             $termSet[$tax] = array();
                         }
                         $termSet[$tax] = array_merge($termSet[$tax], $term_ids);
                     }
                 }
             }
         }
         if (is_null($valid)) {
             // Plonked
             $this->post = NULL;
         } else {
             // We can proceed
             $this->post['tax_input'] = array();
             foreach ($termSet as $tax => $term_ids) {
                 if (!isset($this->post['tax_input'][$tax])) {
                     $this->post['tax_input'][$tax] = array();
                 }
                 $this->post['tax_input'][$tax] = array_merge($this->post['tax_input'][$tax], $term_ids);
             }
             // Now let's add on the feed and global presets
             foreach ($this->preset_terms as $tax => $term_ids) {
                 if (!isset($this->post['tax_input'][$tax])) {
                     $this->post['tax_input'][$tax] = array();
                 }
                 $this->post['tax_input'][$tax] = array_merge($this->post['tax_input'][$tax], $this->category_ids($term_ids, 'create:' . $tax, array($tax), array('singleton' => true)));
             }
         }
     }
     if (!$this->filtered() and $freshness > 0) {
         // Filter some individual fields
         // Allow filters to set post slug. Props niska.
         $post_name = apply_filters('syndicated_post_slug', NULL, $this);
         if (!empty($post_name)) {
             $this->post['post_name'] = $post_name;
         }
         $this->post = apply_filters('syndicated_post', $this->post, $this);
         // Allow for feed-specific syndicated_post filters.
         $this->post = apply_filters("syndicated_post_" . $this->link->uri(), $this->post, $this);
     }
     // Hook in early to make sure these get inserted if at all possible
     add_action('transition_post_status', array(&$this, 'add_rss_meta'), -10000, 3);
     $retval = array(1 => 'updated', 2 => 'new');
     $ret = false;
     if (!$this->filtered() and isset($retval[$freshness])) {
         $diag = array(1 => 'Updating existing post # ' . $this->wp_id() . ', "' . $this->post['post_title'] . '"', 2 => 'Inserting new post "' . $this->post['post_title'] . '"');
         FeedWordPress::diagnostic('syndicated_posts', $diag[$freshness]);
         $this->insert_post($freshness == 1);
         $hook = array(1 => 'update_syndicated_item', 2 => 'post_syndicated_item');
         do_action($hook[$freshness], $this->wp_id(), $this);
         $ret = $retval[$freshness];
     }
     // Remove add_rss_meta hook
     remove_action('transition_post_status', array(&$this, 'add_rss_meta'), -10000, 3);
     return $ret;
 }
 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']);
     }
 }