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