<?php
 class vB_External_Export_Rss_2 extends vB_External_Export_Rss { protected $type = 'RSS2'; protected function buildOutputFromItems($items, $options) { $this->loadRssInfo($options); $xml = new vB_XML_Builder(); $xml->add_group('rss', [ 'version' => '2.0', 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/', 'xmlns:content' => 'http://purl.org/rss/1.0/modules/content/' ]); $xml->add_group('channel'); $xml->add_tag('title', $this->rssinfo['title']); $xml->add_tag('link', $this->rssinfo['link'] . '/', [], false, true); $xml->add_tag('description', $this->rssinfo['description']); $xml->add_tag('language', $this->defaultLang['languagecode']); $xml->add_tag('lastBuildDate', gmdate('D, d M Y H:i:s') . ' GMT'); $xml->add_tag('generator', 'vBulletin'); $xml->add_tag('ttl', $this->rssinfo['ttl']); $xml->add_group('image'); $xml->add_tag('url', $this->rssinfo['icon']); $xml->add_tag('title', $this->rssinfo['title']); $xml->add_tag('link', $this->rssinfo['link'] . '/', [], false, true); $xml->close_group('image'); $channelsInfo = $this->getItemsChannelInfo($items); $items = $this->formatItems($items, $options); foreach ($items AS $id => $item) { $item = $item['content']; $nodeurl = vB_Api::instanceInternal('route')->getAbsoluteNodeUrl($item['external_nodeid']); $xml->add_group('item'); $xml->add_tag('title', $item['external_prefix_plain'] . vB_String::htmlSpecialCharsUni($item['external_title'])); $xml->add_tag('link', $nodeurl, [], false, true); $xml->add_tag('pubDate', gmdate('D, d M Y H:i:s', $item['publishdate']) . ' GMT'); $xml->add_tag('description', $this->getItemDescription($item['rawtext'], $options)); if (empty($options['nohtml'])) { $xml->add_tag('content:encoded', vB_Library::instance('bbcode')->doParse($item['rawtext'])); } $xml->add_tag('category', $channelsInfo[$item['channelid']]['htmltitle'], [ 'domain' => vB_Api::instanceInternal('route')->getAbsoluteNodeUrl($item['channelid']) ]); $xml->add_tag('dc:creator', vB_String::unHtmlSpecialChars($item['authorname'])); $xml->add_tag('guid', vB_Api::instanceInternal('route')->getAbsoluteNodeUrl($item['external_nodeid']), ['isPermaLink' => 'true']); $xml->close_group('item'); } $xml->close_group('channel'); $xml->close_group('rss'); return $xml->fetch_xml(); } } 