示例#1
0
function publish_html($rss) {
$cacheFile = $_SERVER["DOCUMENT_ROOT"] . "/feed/html.cache";
                                       
if (file_exists($cacheFile)) {
    readfile($cacheFile);
    return;
} 
                                     
$repository = "http://svn.svnkit.com/repos/svnkit/tags/";
$contents = read_contents($repository);
$handle = fopen($cacheFile, "w+");
if (!$contents) {
   fwrite($handle, "<tr><td colspan=2><font color=red>Repository is temporary not responding. Try again later.</font></td></tr>");
   fwrite($handle, emergency_html());
   fclose($handle);
   readfile($cacheFile);
   return;
}
$items = publish_rss20($repository, $contents, $rss);
$handle = fopen($cacheFile, "w+");
for($i = 0; $i < count($items) && $i < 3; $i++) {
     fwrite($handle, $items[count($items) - $i - 1]["html_description"]);
}
if (count($items) == 0) {
     fwrite($handle, "<tr><td>repository is temporary not responding. try again later.</td></tr>");
}
fclose($handle);
readfile($cacheFile);
}
示例#2
0
文件: rss2.php 项目: hudson/svnkit
$rss->description = "TMate SVNKit Library Change Log";
$rss->link = "http://svnkit.com/";
$rss->syndicationURL = "http://svnkit.com/" . $PHP_SELF;
$rss->author = "TMate Software"; 
$rss->editor = "TMate Software"; 
$rss->authorEmail = "*****@*****.**"; 
$rss->editorEmail = "*****@*****.**"; 

$repository = "http://svn.svnkit.com/repos/svnkit/tags/";
$contents = read_contents($repository);
if (!$contents) {
   echo $rss->createFeed();
   exit;
}

$items = publish_rss20($repository, $contents, "http://www.svnkit.com/");
for($i = 0; $i < count($items); $i++) {

     $item = $items[$i];

     $rssitem = new FeedItem();

     $rssitem->title  = $item["title"];
     $rssitem->source = $item["source"];
     $rssitem->link   = $item["link"];
     $rssitem->author = $item["author"];
     $rssitem->date   = $item["date"];
     $rssitem->authorEmail = "*****@*****.**"; 
     $rssitem->editorEmail = "*****@*****.**"; 

     $rssitem->description = $item["rss_description"];