示例#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);
 }