1 |
<?php |
2 |
///////////////////////////////////////////////// |
3 |
// PukiWiki - Yet another WikiWikiWeb clone. |
4 |
// |
5 |
// $Id: pukiwiki.ini.php,v 1.13 2002/09/15 07:05:51 masui Exp $ |
6 |
// |
7 |
// RecentChanges の RSS を出力 |
8 |
function plugin_rss10_action() |
9 |
{ |
10 |
global $script,$BracketName,$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 = $rdf_li = ''; |
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($match[2]); |
30 |
if (function_exists('mb_convert_encoding')) |
31 |
$title = mb_convert_encoding($title,'UTF-8','auto'); |
32 |
|
33 |
$dcdate = get_date('Y-m-d\TH:i:sO'); |
34 |
$desc = get_date('D, d M Y H:i:s T',get_filetime($page)); |
35 |
$items .= <<<EOD |
36 |
<item rdf:about="$self$r_url"> |
37 |
<title>$title</title> |
38 |
<link>$self$r_url</link> |
39 |
<dc:date>$dcdate</dc:date> |
40 |
<description>$desc</description> |
41 |
</item> |
42 |
|
43 |
EOD; |
44 |
$rdf_li .= " <rdf:li rdf:resource=\"$self$r_url\" />\n"; |
45 |
} |
46 |
|
47 |
header('Content-type: application/xml'); |
48 |
|
49 |
print <<<EOD |
50 |
<?xml version="1.0" encoding="utf-8"?> |
51 |
|
52 |
<rdf:RDF |
53 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
54 |
xmlns="http://purl.org/rss/1.0/" |
55 |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
56 |
xml:lang="ja"> |
57 |
|
58 |
<channel rdf:about="{$self}rss"> |
59 |
<title>$page_title_utf8</title> |
60 |
<link>$self$whatsnew</link> |
61 |
<description>PukiWiki RecentChanges</description> |
62 |
<items> |
63 |
<rdf:Seq> |
64 |
$rdf_li |
65 |
</rdf:Seq> |
66 |
</items> |
67 |
</channel> |
68 |
|
69 |
$items |
70 |
</rdf:RDF> |
71 |
EOD; |
72 |
exit; |
73 |
} |
74 |
?> |