<?php
 class vB_External_Export_Rss_1 extends vB_External_Export_Rss { protected $type = 'RSS1'; protected function buildOutputFromItems($items, $options) { $this->loadRssInfo($options); if ($this->rssinfo['ttl'] <= 60) { $updateperiod = 'hourly'; $updatefrequency = round(60 / $this->rssinfo['ttl']); } else { $updateperiod = 'daily'; $updatefrequency = round(1440 / $this->rssinfo['ttl']); } $xml = new vB_XML_Builder(); $xml->add_group('rdf:RDF', [ 'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/', 'xmlns:syn' => 'http://purl.org/rss/1.0/modules/syndication/', 'xmlns:content' => 'http://purl.org/rss/1.0/modules/content/', 'xmlns' => 'http://purl.org/rss/1.0/', ]); $xml->add_group('channel', [ 'rdf:about' => $this->rssinfo['link'] ]); $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('syn:updatePeriod', $updateperiod); $xml->add_tag('syn:updateFrequency', $updatefrequency); $xml->add_tag('syn:updateBase', '1970-01-01T00:00Z'); $xml->add_tag('dc:language', $this->defaultLang['languagecode']); $xml->add_tag('dc:creator', 'vBulletin'); $xml->add_tag('dc:date', gmdate('Y-m-d\TH:i:s') . 'Z'); $xml->add_group('items'); $xml->add_group('rdf:Seq'); $xml->add_tag('rdf:li', '', ['rdf:resource' => $this->rssinfo['link'] . '/']); $xml->close_group('rdf:Seq'); $xml->close_group('items'); $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'); $xml->close_group('channel'); $channelsInfo = $this->getItemsChannelInfo($items); $routeApi = vB_Api::instanceInternal('route'); $items = $this->formatItems($items, $options); foreach ($items AS $id => $item) { $item = $item['content']; $xml->add_group('item', ['rdf:about' => $routeApi->getAbsoluteNodeUrl($item['external_nodeid'])]); $xml->add_tag('title', $item['external_prefix_plain'] . vB_String::htmlSpecialCharsUni($item['external_title'])); $xml->add_tag('link', vB_Api::instanceInternal('route')->getAbsoluteNodeUrl($item['external_nodeid']), [], false, true); $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('dc:date', gmdate('Y-m-d\TH:i:s', $item['publishdate']) . 'Z'); $xml->add_tag('dc:creator', vB_String::unHtmlSpecialChars($item['authorname'])); $xml->add_tag('dc:subject', $channelsInfo[$item['channelid']]['htmltitle']); $xml->close_group('item'); } $xml->close_group('rdf:RDF'); return $xml->fetch_xml(); } } 