Exemplo n.º 1
0
$c = $c[0];
$s = $c->GetService();
header('content-type: application/xhtml+xml');
print '<?xml version="1.0" encoding="utf-8"?>';
?>

<rss version="2.0">
  <channel>
    <link><?php 
echo $s->GetURL();
?>
</link>
    <language>ru</language>
    <title><?php 
echo $s->GetTitle();
?>
</title>
    <description><?php 
echo $s->GetDescription();
?>
</description>
    <pubDate><?php 
echo FullLocalTime(time());
?>
</pubDate>
  </channel>
<?php 
echo $s->GetRSSData();
?>
</rss>
Exemplo n.º 2
0
 function GetRSSData()
 {
     $res = '';
     $percontent = opt_get('rss_items_per_content');
     $prefix = config_get('http-document-root');
     if (is_array($this->settings['contents'])) {
         foreach ($this->settings['contents'] as $cid => $dummy) {
             $c = wiki_spawn_content($cid);
             if ($c->GetID() <= 0) {
                 unset($this->settings['contents'][$cid]);
                 continue;
             }
             $arr = $c->GetRSSData($percontent);
             $n = min(count($arr), $percontent);
             for ($i = 0; $i < $n; $i++) {
                 $linkPrefix = $prefix . $c->GetFullHTTPPath();
                 $row = $arr[$i];
                 $row['timestamp'] = $timestamp;
                 $res .= "  <item>\n";
                 $res .= '    <title>' . htmlspecialchars($row['title']) . '</title>' . "\n";
                 if ($row['link'] != '') {
                     $res .= '    <link>' . $linkPrefix . '/' . $row['link'] . '</link>' . "\n";
                 }
                 $res .= '    <description>' . htmlspecialchars($row['description']) . '</description>' . "\n";
                 if ($row['comments'] != '') {
                     $res .= '    <comments>' . $row['comments'] . '</comments>' . "\n";
                 }
                 $res .= '    <pubDate>' . FullLocalTime($row['pubdate']) . '</pubDate>' . "\n";
                 if ($row['dccreator'] != '') {
                     $res .= '    <dc:creator>' . htmlspecialchars($row['dccreator']) . '</dc:creator>' . "\n";
                 }
                 $res .= "  </item>\n";
             }
         }
     }
     return setvars($res);
 }