2 rcs_id('$Id: RecentReferrers.php,v 1.1 2004-11-06 04:52:29 rurban Exp $');
5 * Analyze our ACCESS_LOG
9 include_once("lib/PageList.php");
11 class WikiPlugin_RecentReferrers extends WikiPlugin
14 return _("RecentReferrers");
17 function getVersion() {
18 return preg_replace("/[Revision: $]/", '',
22 function getDefaultArguments() {
25 PageList::supportedArgs(),
33 function run($dbi, $argstr, &$request, $basepage) {
34 if (!ACCESS_LOG) return;
35 $args = $this->getArgs($argstr, $request);
36 $table = HTML::table(array('cellpadding' => 1,
39 'class' => 'pagelist'));
40 if (!$args['noheader'] and !empty($args['caption']))
41 $table->pushContent(HTML::caption(array('align'=>'top'), $args['caption']));
43 $limit = $args['limit'];
44 $logentry = new Request_AccessLogEntry(ACCESS_LOG);
45 while ($logentry->read()) {
46 if (!empty($logentry->referer)) {
48 if ($limit and count($logs) > $limit)
50 $logentry = new Request_AccessLogEntry(ACCESS_LOG);
54 $logs = array_reverse($logs);
55 $table->pushContent(HTML::tr(HTML::th("Target"),HTML::th("Referrer"),
56 HTML::th("Host"),HTML::th("Date")));
57 $logs = array_slice($logs,0,min($limit,count($logs)));
58 foreach ($logs as $logentry) {
59 $table->pushContent(HTML::tr(HTML::td($logentry->request),
60 HTML::td($logentry->referer),
61 HTML::td($logentry->host),
62 HTML::td($logentry->time)
70 // $Log: not supported by cvs2svn $
72 // (c-file-style: "gnu")
77 // c-hanging-comment-ender-p: nil
78 // indent-tabs-mode: nil