OSDN Git Service

BugTrack/791: Fix typo 0,91 => 0.91
[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.13 2004/09/04 14:26:52 henoheno Exp $
16  */
17
18 // RecentChanges¤Î¥­¥ã¥Ã¥·¥å
19 define('PLUGIN_RECENT_CACHE', CACHE_DIR . 'recent.dat');
20
21 function plugin_recent_convert()
22 {
23         global $script, $vars, $date_format;
24         global $_recent_plugin_frame;
25
26         if (! file_exists(PLUGIN_RECENT_CACHE)) return '';
27
28         $recent_lines = 10;
29         if (func_num_args()) {
30                 $args = func_get_args();
31                 if (is_numeric($args[0]))
32                         $recent_lines = $args[0];
33         }
34
35         // ÀèƬ¤ÎN·ï(¹Ô)¤ò¼è¤ê½Ð¤¹
36         $lines = array_splice(file(PLUGIN_RECENT_CACHE), 0, $recent_lines);
37
38         $date = $items = '';
39         foreach ($lines as $line) {
40                 list($time, $page) = explode("\t", rtrim($line));
41                 $_date = get_date($date_format, $time);
42                 if ($date != $_date) {
43                         if ($date != '') $items .= '</ul>';
44                         $date = $_date;
45                         $items .= "<strong>$date</strong>\n" .
46                                 "<ul class=\"recent_list\">\n";
47                 }
48                 $s_page = htmlspecialchars($page);
49                 $r_page = rawurlencode($page);
50                 $pg_passage = get_pg_passage($page, FALSE);
51                 if($page == $vars['page']) {
52                         // No need to link itself, notifies where you just read
53                         $items .= " <li><span title=\"$s_page $pg_passage\">$s_page</span></li>\n";
54                 } else {
55                         $items .= " <li><a href=\"$script?$r_page\" title=\"$s_page $pg_passage\">$s_page</a></li>\n";
56                 }
57         }
58         if (! empty($lines)) $items .= "</ul>\n";
59
60         return sprintf($_recent_plugin_frame, count($lines), $items);
61 }
62 ?>