修訂 | 48cdfe5451ec10415df469e51a75f9c72f4f6562 (tree) |
---|---|
時間 | 2004-09-04 23:53:13 |
作者 | henoheno <henoheno> |
Commiter | henoheno |
Just a cleanup. Remove unused / Added spaces and \n
@@ -2,7 +2,7 @@ | ||
2 | 2 | ///////////////////////////////////////////////// |
3 | 3 | // PukiWiki - Yet another WikiWikiWeb clone. |
4 | 4 | // |
5 | -// $Id: popular.inc.php,v 1.9 2004/07/31 03:09:20 henoheno Exp $ | |
5 | +// $Id: popular.inc.php,v 1.10 2004/09/04 14:53:13 henoheno Exp $ | |
6 | 6 | // |
7 | 7 | |
8 | 8 | /* |
@@ -27,69 +27,58 @@ | ||
27 | 27 | |
28 | 28 | function plugin_popular_convert() |
29 | 29 | { |
30 | + global $whatsnew, $non_list; | |
30 | 31 | global $_popular_plugin_frame, $_popular_plugin_today_frame; |
31 | - global $script,$whatsnew,$non_list; | |
32 | 32 | |
33 | 33 | $max = 10; |
34 | 34 | $except = ''; |
35 | 35 | |
36 | 36 | $array = func_get_args(); |
37 | 37 | $today = FALSE; |
38 | - | |
39 | 38 | switch (func_num_args()) { |
40 | - case 3: | |
41 | - if ($array[2]) | |
42 | - $today = get_date('Y/m/d'); | |
43 | - case 2: | |
44 | - $except = $array[1]; | |
45 | - case 1: | |
46 | - $max = $array[0]; | |
39 | + case 3: if ($array[2]) $today = get_date('Y/m/d'); | |
40 | + case 2: $except = $array[1]; | |
41 | + case 1: $max = $array[0]; | |
47 | 42 | } |
48 | 43 | |
49 | 44 | $counters = array(); |
50 | - | |
51 | - foreach (get_existpages(COUNTER_DIR,'.count') as $file=>$page) { | |
52 | - if ($except != '' and ereg($except,$page)) { | |
53 | - continue; | |
54 | - } | |
55 | - if ($page == $whatsnew or preg_match("/$non_list/",$page) or !is_page($page)) { | |
45 | + foreach (get_existpages(COUNTER_DIR, '.count') as $file=>$page) { | |
46 | + if (($except != '' && ereg($except, $page)) || | |
47 | + $page == $whatsnew || preg_match("/$non_list/", $page) || | |
48 | + ! is_page($page)) { | |
56 | 49 | continue; |
57 | 50 | } |
58 | 51 | |
59 | - $array = file(COUNTER_DIR.$file); | |
52 | + $array = file(COUNTER_DIR . $file); | |
60 | 53 | $count = rtrim($array[0]); |
61 | - $date = rtrim($array[1]); | |
54 | + $date = rtrim($array[1]); | |
62 | 55 | $today_count = rtrim($array[2]); |
63 | - $yesterday_count = rtrim($array[3]); | |
64 | 56 | |
65 | 57 | if ($today) { |
66 | - if ($today == $date) { | |
67 | - // $pageが数値に見える(たとえばencode('BBS')=424253)とき、 | |
68 | - // array_splice()によってキー値が変更されてしまうのを防ぐ | |
69 | - $counters["_$page"] = $today_count; | |
70 | - } | |
71 | - } | |
72 | - else { | |
58 | + // $pageが数値に見える(たとえばencode('BBS')=424253)とき、 | |
59 | + // array_splice()によってキー値が変更されてしまうのを防ぐ | |
60 | + if ($today == $date) $counters["_$page"] = $today_count; | |
61 | + } else { | |
73 | 62 | $counters["_$page"] = $count; |
74 | 63 | } |
75 | 64 | } |
76 | 65 | |
77 | 66 | asort($counters, SORT_NUMERIC); |
78 | - $counters = array_splice(array_reverse($counters,TRUE),0,$max); | |
67 | + $counters = array_splice(array_reverse($counters, TRUE), 0, $max); | |
79 | 68 | |
80 | 69 | $items = ''; |
81 | - if (count($counters)) { | |
82 | - $items = '<ul class="popular_list">'; | |
70 | + if (! empty($counters)) { | |
71 | + $items = "<ul class=\"popular_list\">\n"; | |
83 | 72 | |
84 | 73 | foreach ($counters as $page=>$count) { |
85 | - $page = substr($page,1); | |
74 | + $page = substr($page, 1); | |
86 | 75 | |
87 | 76 | $s_page = htmlspecialchars($page); |
88 | - $items .= " <li>".make_pagelink($page,"$s_page<span class=\"counter\">($count)</span>")."</li>\n"; | |
77 | + $items .= ' <li>' . make_pagelink($page, "$s_page<span class=\"counter\">($count)</span>") . "</li>\n"; | |
89 | 78 | } |
90 | - $items .= '</ul>'; | |
79 | + $items .= "</ul>\n"; | |
91 | 80 | } |
92 | - return sprintf($today ? $_popular_plugin_today_frame : $_popular_plugin_frame,count($counters),$items); | |
93 | -} | |
94 | 81 | |
82 | + return sprintf($today ? $_popular_plugin_today_frame : $_popular_plugin_frame, count($counters), $items); | |
83 | +} | |
95 | 84 | ?> |