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 = 'http://'.SERVER_NAME.PHP_SELF.'?'; |
$self = 'http://'.SERVER_NAME.PHP_SELF.'?'; |
13 |
|
|
14 |
$page_title_utf8 = $page_title; |
$page_title_utf8 = $page_title; |
15 |
if (function_exists('mb_convert_encoding')) |
if (function_exists('mb_convert_encoding')) { |
16 |
$page_title_utf8 = mb_convert_encoding($page_title_utf8,'UTF-8','auto'); |
$page_title_utf8 = mb_convert_encoding($page_title_utf8,'UTF-8',SOURCE_ENCODING); |
17 |
|
} |
18 |
|
|
19 |
$items = $rdf_li = ''; |
$items = $rdf_li = ''; |
20 |
$lines = array_splice(preg_grep('/^\/\//',get_source($whatsnew)),0,$rss_max); |
|
21 |
|
if (!file_exists(CACHE_DIR.'recent.dat')) { |
22 |
foreach($lines as $line) { |
return ''; |
23 |
if (!preg_match("/^\/\/(\d+)\s($BracketName)$/",$line,$match)) |
} |
24 |
continue; // fatal error, die? |
$recent = file(CACHE_DIR.'recent.dat'); |
25 |
|
$lines = array_splice($recent,0,$rss_max); |
26 |
$page = $match[2]; |
foreach ($lines as $line) { |
27 |
|
list($time,$page) = explode("\t",rtrim($line)); |
28 |
$r_url = rawurlencode($page); |
$r_page = rawurlencode($page); |
29 |
|
$title = $page; |
30 |
$title = strip_bracket($match[2]); |
if (function_exists('mb_convert_encoding')) { |
31 |
if (function_exists('mb_convert_encoding')) |
$title = mb_convert_encoding($title,'UTF-8',SOURCE_ENCODING); |
32 |
$title = mb_convert_encoding($title,'UTF-8','auto'); |
} |
33 |
|
|
34 |
$dcdate = get_date('Y-m-d\TH:i:sO'); |
$dcdate = get_date('Y-m-d\TH:i:sO'); |
35 |
$desc = get_date('D, d M Y H:i:s T',get_filetime($page)); |
$desc = get_date('D, d M Y H:i:s T',$time); |
36 |
$items .= <<<EOD |
$items .= <<<EOD |
37 |
<item rdf:about="$self$r_url"> |
<item rdf:about="$self$r_page"> |
38 |
<title>$title</title> |
<title>$title</title> |
39 |
<link>$self$r_url</link> |
<link>$self$r_page</link> |
40 |
<dc:date>$dcdate</dc:date> |
<dc:date>$dcdate</dc:date> |
41 |
<description>$desc</description> |
<description>$desc</description> |
42 |
</item> |
</item> |
43 |
|
|
44 |
EOD; |
EOD; |
45 |
$rdf_li .= " <rdf:li rdf:resource=\"$self$r_url\" />\n"; |
$rdf_li .= " <rdf:li rdf:resource=\"$self$r_page\" />\n"; |
46 |
} |
} |
47 |
|
|
48 |
header('Content-type: application/xml'); |
header('Content-type: application/xml'); |