OSDN Git Service

RecentChanges: Update
[pukiwiki/pukiwiki.git] / plugin / recent.inc.php
1 <?php
2 /*
3  * PukiWiki ºÇ¿·¤Î?·ï¤òɽ¼¨¤¹¤ë¥×¥é¥°¥¤¥ó
4  *
5  * CopyRight 2002 Y.MASUI GPL2
6  * http://masui.net/pukiwiki/ masui@masui.net
7  *
8  * Êѹ¹ÍúÎò:
9  *  2002.04.08: pat¤µ¤ó¡¢¤ß¤Î¤ë¤µ¤ó¤Î»ØŦ¤Ë¤è¤ê¡¢¥ê¥ó¥¯À褬ÆüËܸì¤Î¾ì¹ç¤Ë
10  *              ²½¤±¤ë¤Î¤ò½¤Àµ
11  *
12  *  2002.06.17: plugin_recent_init()¤òÀßÄê
13  *  2002.07.02: <ul>¤Ë¤è¤ë½ÐÎϤËÊѹ¹¤·¹½Â¤²½
14  *
15  * $Id: recent.inc.php,v 1.11 2004/07/31 03:09:20 henoheno Exp $
16  */
17
18 function plugin_recent_convert()
19 {
20         global $script,$BracketName,$date_format;
21         global $_recent_plugin_frame;
22
23         $recent_lines = 10;
24         if (func_num_args()) {
25                 $args = func_get_args();
26                 if (is_numeric($args[0])) {
27                         $recent_lines = $args[0];
28                 }
29         }
30
31         $date = $items = '';
32         if (!file_exists(CACHE_DIR.'recent.dat')) {
33                 return '';
34         }
35         $recent = file(CACHE_DIR.'recent.dat');
36         $lines = array_splice($recent,0,$recent_lines);
37         foreach ($lines as $line) {
38                 list($time,$page) = explode("\t",rtrim($line));
39                 $_date = get_date($date_format,$time);
40                 if ($date != $_date) {
41                         if ($date != '') {
42                                 $items .= '</ul>';
43                         }
44                         $date = $_date;
45                         $items .= "<strong>$date</strong>\n<ul class=\"recent_list\">";
46                 }
47                 $s_page = htmlspecialchars($page);
48                 $r_page = rawurlencode($page);
49                 $pg_passage = get_pg_passage($page,FALSE);
50                 $items .=" <li><a href=\"$script?$r_page\" title=\"$s_page $pg_passage\">$s_page</a></li>\n";
51         }
52         if (count($lines)) {
53                 $items .='</ul>';
54         }
55         return sprintf($_recent_plugin_frame,count($lines),$items);
56 }
57 ?>