SyndicatedPost::validate_post_id PHP Méthode

validate_post_id() public méthode

SyndicatedPost::validate_post_id()
public validate_post_id ( array $dbpost, $is_update, mixed $ns )
$dbpost array An array representing the post we attempted to insert or update
$ns mixed A string or array representing the namespace (class, method) whence this method was called.
    function validate_post_id($dbpost, $is_update, $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) {
            $verb = $is_update ? 'update existing' : 'insert new';
            $guid = $this->guid();
            $url = $this->permalink();
            $feed = $this->link->uri(array('add_params' => true));
            // wp_insert_post failed. Diagnostics, or barf up a critical bug
            // notice if we are in debug mode.
            $mesg = "Failed to {$verb} item [{$guid}]. WordPress API returned no valid post ID.\n" . "\t\tID = " . serialize($this->_wp_id) . "\n" . "\t\tURL = " . MyPHP::val($url) . "\t\tFeed = " . MyPHP::val($feed);
            FeedWordPress::diagnostic('updated_feeds:errors', "WordPress API error: {$mesg}");
            FeedWordPress::diagnostic('feed_items:rejected', $mesg);
            $mesg = <<<EOM
The WordPress API returned an invalid post ID
\t\t\t   when FeedWordPress tried to {$verb} item {$guid}
\t\t\t   [URL: {$url}]
\t\t\t   from the feed at {$feed}

{$ns}::_wp_id
EOM;
            FeedWordPress::noncritical_bug($mesg, array("\$this->_wp_id" => $this->_wp_id, "\$dbpost" => $dbpost), __LINE__, __FILE__);
        }
    }