コード例 #1
0
ファイル: 1.php プロジェクト: cedwards-reisys/nexus-web
 protected function buildOutputFromItems($items, $options)
 {
     parent::buildOutputFromItems($items, $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', array('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', array('rdf:about' => $this->rssinfo['link']));
     $xml->add_tag('title', $this->rssinfo['title']);
     $xml->add_tag('link', $this->rssinfo['link'] . '/', array(), 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', '', array('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'] . '/', array(), false, true);
     $xml->close_group('image');
     $xml->close_group('channel');
     // gather channel info
     $channelsInfo = $this->getItemsChannelInfo($items);
     $items = $this->formatItems($items, $options);
     foreach ($items as $id => $item) {
         $item = $item['content'];
         $xml->add_group('item', array('rdf:about' => vB_Api::instanceInternal('route')->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']), array(), 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();
 }
コード例 #2
0
ファイル: 2.php プロジェクト: cedwards-reisys/nexus-web
 protected function buildOutputFromItems($items, $options)
 {
     parent::buildOutputFromItems($items, $options);
     $xml = new vB_Xml_Builder();
     $xml->add_group('rss', array('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'] . '/', array(), 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'] . '/', array(), false, true);
     $xml->close_group('image');
     // gather channel info
     $channelsInfo = $this->getItemsChannelInfo($items);
     $items = $this->formatItems($items, $options);
     foreach ($items as $id => $item) {
         $item = $item['content'];
         $xml->add_group('item');
         $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']), array(), 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'], array('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']), array('isPermaLink' => 'true'));
         $xml->close_group('item');
     }
     $xml->close_group('channel');
     $xml->close_group('rss');
     return $xml->fetch_xml();
 }