示例#1
0
 function cookFeed($title, $link, $file_name, $db)
 {
     require_once TE_DIR . '/lib/rssgen/rssgen.php';
     $rssgen = new \zelenin\rssgen();
     $rssgen->channel($link);
     $rssgen->channel_title($title);
     $rssgen->channel_link($link);
     $rssgen->channel_description(SITE_DESC);
     $rssgen->channel_copyright('Copyright, ' . SITE_NAME . date(' Y'));
     $rssgen->channel_pubDate(time(), true);
     $rssgen->channel_lastBuildDate(time(), true);
     foreach ($db as $item) {
         if (GESHI) {
             $item['content'] = preg_replace_callback("!<pre lang=\"(.*?)\">(.*?)</pre>!si", geshi_syntax, $item['content']);
         }
         $rssgen->item();
         $rssgen->item_title($item['title']);
         $rssgen->item_link(SITE_URL . '/?id=' . $item['id']);
         $rssgen->item_description($item['content']);
         $rssgen->item_author($item['author']);
         $rssgen->item_guid(SITE_URL . '/?id=' . $item['id'], 'true');
         $rssgen->item_pubDate($item['stamp'], true);
         $rssgen->item_source(SITE_NAME, SITE_URL);
     }
     $rssgen->save($file_name);
     unset($rssgen);
 }
示例#2
0
文件: e.php 项目: noisywiz/tractor
<?php

require_once 'rssgen.php';
$rssgen = new \zelenin\rssgen();
$rssgen->channel();
// $rssgen->channel( 'http://example.com/rss.xml' );
// required channel elements
$rssgen->channel_title('Channel title');
$rssgen->channel_link('http://example.com');
$rssgen->channel_description('Channel description');
// optional channel elements
$rssgen->channel_language('en-us');
$rssgen->channel_copyright('Channel copyright, ' . date('Y'));
$rssgen->channel_pubDate(1300000000, true);
$rssgen->channel_lastBuildDate(1300000000, true);
$rssgen->channel_image('http://example.com/channel.jpg', 'http://example.com', '88', '31', 'Image description');
$rssgen->item();
// title or description are required
$rssgen->item_title('Item title');
$rssgen->item_link('http://example.com/post1');
$rssgen->item_description('Item description');
$rssgen->item_author('author@example.com (John Doe)');
$rssgen->item_guid('http://example.com/post1', 'true');
$rssgen->item_pubDate(time(), true);
$rssgen->item_source('RSS title', 'http://example.com/rss.xml');
echo $rssgen;
// $rssgen->save( 'rss.xml' );