による出力に変更し構造化
*
* $Id: recent.inc.php,v 1.13 2004/09/04 14:26:52 henoheno Exp $
*/
// RecentChangesのキャッシュ
define('PLUGIN_RECENT_CACHE', CACHE_DIR . 'recent.dat');
function plugin_recent_convert()
{
global $script, $vars, $date_format;
global $_recent_plugin_frame;
if (! file_exists(PLUGIN_RECENT_CACHE)) return '';
$recent_lines = 10;
if (func_num_args()) {
$args = func_get_args();
if (is_numeric($args[0]))
$recent_lines = $args[0];
}
// 先頭のN件(行)を取り出す
$lines = array_splice(file(PLUGIN_RECENT_CACHE), 0, $recent_lines);
$date = $items = '';
$items .= '
';
foreach ($lines as $line) {
list($time, $page) = explode("\t", rtrim($line));
$_date = get_date($date_format, $time);
if ($date != $_date) {
$date = $_date;
}
$s_page = htmlspecialchars($page);
$s_page = ereg_replace( "/", "/ ", $s_page );
$r_page = rawurlencode($page);
$pg_passage = get_pg_passage($page, FALSE);
if($page == $vars['page']) {
// No need to link itself, notifies where you just read
$items .= " - $s_page
└ at $date \n";
} else {
$items .= " - $s_page
└ at $date \n";
}
}
$items .= '
';
if (! empty($lines)) $items .= "\n";
return sprintf($_recent_plugin_frame, count($lines), $items);
}
?>