1 |
<?php |
2 |
///////////////////////////////////////////////// |
3 |
// PukiWiki - Yet another WikiWikiWeb clone. |
4 |
// |
5 |
// $Id: rss10.inc.php,v 1.1 2003/01/27 05:38:46 panda Exp $ |
6 |
// |
7 |
// RecentChanges の RSS を出力 |
8 |
function plugin_rss10_action() |
9 |
{ |
10 |
global $script,$rss_max,$page_title,$whatsnew; |
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',SOURCE_ENCODING); |
17 |
} |
18 |
|
19 |
$items = $rdf_li = ''; |
20 |
|
21 |
if (!file_exists(CACHE_DIR.'recent.dat')) { |
22 |
return ''; |
23 |
} |
24 |
$recent = file(CACHE_DIR.'recent.dat'); |
25 |
$lines = array_splice($recent,0,$rss_max); |
26 |
foreach ($lines as $line) { |
27 |
list($time,$page) = explode("\t",rtrim($line)); |
28 |
$r_page = rawurlencode($page); |
29 |
$title = $page; |
30 |
if (function_exists('mb_convert_encoding')) { |
31 |
$title = mb_convert_encoding($title,'UTF-8',SOURCE_ENCODING); |
32 |
} |
33 |
|
34 |
$dcdate = get_date('Y-m-d\TH:i:sO'); |
35 |
$desc = get_date('D, d M Y H:i:s T',$time); |
36 |
$items .= <<<EOD |
37 |
<item rdf:about="$self$r_page"> |
38 |
<title>$title</title> |
39 |
<link>$self$r_page</link> |
40 |
<dc:date>$dcdate</dc:date> |
41 |
<description>$desc</description> |
42 |
</item> |
43 |
|
44 |
EOD; |
45 |
$rdf_li .= " <rdf:li rdf:resource=\"$self$r_page\" />\n"; |
46 |
} |
47 |
|
48 |
header('Content-type: application/xml'); |
49 |
|
50 |
print <<<EOD |
51 |
<?xml version="1.0" encoding="utf-8"?> |
52 |
|
53 |
<rdf:RDF |
54 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
55 |
xmlns="http://purl.org/rss/1.0/" |
56 |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
57 |
xml:lang="ja"> |
58 |
|
59 |
<channel rdf:about="{$self}rss"> |
60 |
<title>$page_title_utf8</title> |
61 |
<link>$self$whatsnew</link> |
62 |
<description>PukiWiki RecentChanges</description> |
63 |
<items> |
64 |
<rdf:Seq> |
65 |
$rdf_li |
66 |
</rdf:Seq> |
67 |
</items> |
68 |
</channel> |
69 |
|
70 |
$items |
71 |
</rdf:RDF> |
72 |
EOD; |
73 |
exit; |
74 |
} |
75 |
?> |