OSDN Git Service

PukiWiki/1.4 first beta release
[pukiwiki/pukiwiki.git] / plugin / rss.inc.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: rss.inc.php,v 1.1 2003/01/27 05:38:46 panda Exp $
6 //
7 // RecentChanges ¤Î RSS ¤ò½ÐÎÏ
8 function plugin_rss_action()
9 {
10         global $script,$rss_max,$page_title,$whatsnew,$BracketName;
11
12         $self = 'http://'.SERVER_NAME.PHP_SELF.'?';
13
14         $page_title_utf8 = $page_title;
15         if (function_exists('mb_convert_encoding'))
16                 $page_title_utf8 = mb_convert_encoding($page_title_utf8,'UTF-8','auto');
17
18         $items = '';
19         $lines = array_splice(preg_grep('/^\/\//',get_source($whatsnew)),0,$rss_max);
20         
21         foreach($lines as $line) {
22                 if (!preg_match("/^\/\/(\d+)\s($BracketName)$/",$line,$match))
23                         continue; // fatal error, die?
24                 
25                 $page = $match[2];
26                 
27                 $r_url = rawurlencode($page);
28                 
29                 $title = strip_bracket($page);
30                 if (function_exists('mb_convert_encoding'))
31                         $title = mb_convert_encoding($title,'UTF-8','auto');
32                 
33                 $desc = get_date('D, d M Y H:i:s T',get_filetime($page));
34                 $items .= <<<EOD
35 <item>
36  <title>$title</title>
37  <link>$self$r_url</link>
38  <description>$desc</description>
39 </item>
40
41 EOD;
42         }
43         
44         header('Content-type: application/xml');
45         
46         print <<<EOD
47 <?xml version="1.0" encoding="UTF-8"?>
48
49 <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
50             "http://my.netscape.com/publish/formats/rss-0.91.dtd">
51
52 <rss version="0.91">
53
54 <channel>
55 <title>$page_title_utf8</title>
56 <link>$self$whatsnew</link>
57 <description>PukiWiki RecentChanges</description>
58 <language>ja</language>
59
60 $items
61 </channel>
62 </rss>
63 EOD;
64         exit;
65 }
66 ?>