7 |
// RecentChanges の RSS を出力 |
// RecentChanges の RSS を出力 |
8 |
function plugin_rss10_action() |
function plugin_rss10_action() |
9 |
{ |
{ |
10 |
global $script,$BracketName,$rss_max,$page_title,$whatsnew,$BracketName; |
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 |
|
|
|
$self = 'http://'.SERVER_NAME.PHP_SELF.'?'; |
|
|
|
|
|
$page_title_utf8 = $page_title; |
|
|
if (function_exists('mb_convert_encoding')) |
|
|
$page_title_utf8 = mb_convert_encoding($page_title_utf8,'UTF-8','auto'); |
|
|
|
|
16 |
$items = $rdf_li = ''; |
$items = $rdf_li = ''; |
|
$lines = array_splice(preg_grep('/^\/\//',get_source($whatsnew)),0,$rss_max); |
|
17 |
|
|
18 |
foreach($lines as $line) { |
if (!file_exists(CACHE_DIR.'recent.dat')) |
19 |
if (!preg_match("/^\/\/(\d+)\s($BracketName)$/",$line,$match)) |
{ |
20 |
continue; // fatal error, die? |
return ''; |
21 |
|
} |
22 |
$page = $match[2]; |
$recent = file(CACHE_DIR.'recent.dat'); |
23 |
|
$lines = array_splice($recent,0,$rss_max); |
24 |
$r_url = rawurlencode($page); |
foreach ($lines as $line) |
25 |
|
{ |
26 |
|
list($time,$page) = explode("\t",rtrim($line)); |
27 |
|
$r_page = rawurlencode($page); |
28 |
|
$title = mb_convert_encoding($page,'UTF-8',SOURCE_ENCODING); |
29 |
|
// 'O'が出力する時刻を'+09:00'の形に整形 |
30 |
|
$dcdate = substr_replace(get_date('Y-m-d\TH:i:sO',$time),':',-2,0); |
31 |
|
|
32 |
$title = strip_bracket($match[2]); |
// $desc = get_date('D, d M Y H:i:s T',$time); |
33 |
if (function_exists('mb_convert_encoding')) |
// <description>$desc</description> |
|
$title = mb_convert_encoding($title,'UTF-8','auto'); |
|
34 |
|
|
|
$dcdate = get_date('Y-m-d\TH:i:sO'); |
|
|
$desc = get_date('D, d M Y H:i:s T',get_filetime($page)); |
|
35 |
$items .= <<<EOD |
$items .= <<<EOD |
36 |
<item rdf:about="$self$r_url"> |
<item rdf:about="$script?$r_page"> |
37 |
<title>$title</title> |
<title>$title</title> |
38 |
<link>$self$r_url</link> |
<link>$script?$r_page</link> |
39 |
<dc:date>$dcdate</dc:date> |
<dc:date>$dcdate</dc:date> |
|
<description>$desc</description> |
|
40 |
</item> |
</item> |
41 |
|
|
42 |
EOD; |
EOD; |
43 |
$rdf_li .= " <rdf:li rdf:resource=\"$self$r_url\" />\n"; |
$rdf_li .= " <rdf:li rdf:resource=\"$script?$r_page\" />\n"; |
44 |
} |
} |
45 |
|
|
46 |
header('Content-type: application/xml'); |
header('Content-type: application/xml'); |
54 |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
55 |
xml:lang="ja"> |
xml:lang="ja"> |
56 |
|
|
57 |
<channel rdf:about="{$self}rss"> |
<channel rdf:about="$script?rss"> |
58 |
<title>$page_title_utf8</title> |
<title>$page_title_utf8</title> |
59 |
<link>$self$whatsnew</link> |
<link>$script?$whatsnew</link> |
60 |
<description>PukiWiki RecentChanges</description> |
<description>PukiWiki RecentChanges</description> |
61 |
<items> |
<items> |
62 |
<rdf:Seq> |
<rdf:Seq> |