public function add_comments($xml, $comments)
{
foreach ($comments as $comment) {
$content = $this->is_auth() ? Utils::htmlspecialchars($comment->content) : Utils::htmlspecialchars($comment->content_atom);
$content = Plugins::filter('atom_add_comment', $content, $comment);
$item = $xml->addChild('entry');
$title = $item->addChild('title', Utils::htmlspecialchars(_t('%1$s on "%2$s"', array($comment->name, $comment->post->title))));
$link = $item->addChild('link');
$link->addAttribute('rel', 'alternate');
$link->addAttribute('href', $comment->post->permalink . '#comment-' . $comment->id);
$author = $item->addChild('author');
$author_name = $author->addChild('name', Utils::htmlspecialchars($comment->name));
$author_uri = $author->addChild('uri', Utils::htmlspecialchars($comment->url));
$id = $item->addChild('id', $comment->post->guid . '/' . $comment->id);
$updated = $item->addChild('updated', $comment->date->get('c'));
$content = $item->addChild('content', $content);
$content->addAttribute('type', 'html');
Plugins::act('atom_add_comment', $item, $comment);
}
return $xml;
}