function parseComment(DOMNode $comment, &$wpid)
{
static $map = array('author' => 'name', 'author_email' => 'email', 'author_url' => 'uri', 'author_IP' => 'ipAddress', 'content' => 'body');
$datelocal = 0;
$datelocalstr = 0;
$dateutc = 0;
$c = new GBComment();
$wpid = 0;
foreach ($comment->childNodes as $n) {
if ($n->nodeType !== XML_ELEMENT_NODE) {
continue;
}
$name = '' . $n->nodeName;
$k = substr($name, 11);
if ($k === 'date_gmt') {
$dateutc = new GBDateTime($n->nodeValue);
} elseif ($k === 'date') {
$datelocal = new GBDateTime($n->nodeValue);
$datelocalstr = $n->nodeValue;
} elseif ($k === 'approved') {
$c->approved = (bool) $n->nodeValue;
} elseif ($k === 'id') {
$wpid = (int) $n->nodeValue;
} elseif ($k === 'type') {
$c->type = $n->nodeValue === 'pingback' ? GBComment::TYPE_PINGBACK : GBComment::TYPE_COMMENT;
} elseif (isset($map[$k])) {
$dst = $map[$k];
$c->{$dst} = $n->nodeValue;
} else {
gb::log(LOG_INFO, 'discarding ' . $name);
}
}
# date
$c->date = $this->_mkdatetime($datelocal, $dateutc, $datelocalstr, 0);
# fix pingback message
#if ($c->type === GBComment::TYPE_PINGBACK)
# $c->body = html_entity_decode($c->body, ENT_COMPAT, 'UTF-8');
return $c;
}