11878f16fSAndreas Gohr<?php 21878f16fSAndreas Gohr/** 31878f16fSAndreas Gohr * statistics plugin 41878f16fSAndreas Gohr * 51878f16fSAndreas Gohr * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 66b6f8822SAndreas Gohr * @author Andreas Gohr <gohr@splitbrain.org> 71878f16fSAndreas Gohr */ 81878f16fSAndreas Gohr 91878f16fSAndreas Gohr// must be run within Dokuwiki 101878f16fSAndreas Gohrif(!defined('DOKU_INC')) die(); 111878f16fSAndreas Gohr 122998b1f6SAndreas Gohr 131878f16fSAndreas Gohr/** 141878f16fSAndreas Gohr * All DokuWiki plugins to extend the admin function 151878f16fSAndreas Gohr * need to inherit from this class 161878f16fSAndreas Gohr */ 171878f16fSAndreas Gohrclass admin_plugin_statistics extends DokuWiki_Admin_Plugin { 18a901d721SAndreas Gohr public $dblink = null; 19a901d721SAndreas Gohr protected $opt = ''; 20a901d721SAndreas Gohr protected $from = ''; 21a901d721SAndreas Gohr protected $to = ''; 22a901d721SAndreas Gohr protected $start = ''; 23a901d721SAndreas Gohr protected $tlimit = ''; 24a901d721SAndreas Gohr 25a901d721SAndreas Gohr /** 26a901d721SAndreas Gohr * Available statistic pages 27a901d721SAndreas Gohr */ 28a901d721SAndreas Gohr protected $pages = array('dashboard','page','referer','newreferer', 295bccfe87SAndreas Gohr 'outlinks','searchengines','searchphrases', 305bccfe87SAndreas Gohr 'searchwords', 'internalsearchphrases', 315bccfe87SAndreas Gohr 'internalsearchwords','browsers','os', 325bccfe87SAndreas Gohr 'countries','resolution'); 331878f16fSAndreas Gohr 341878f16fSAndreas Gohr /** 356b6f8822SAndreas Gohr * Initialize the helper 366b6f8822SAndreas Gohr */ 376b6f8822SAndreas Gohr public function __construct() { 386b6f8822SAndreas Gohr $this->hlp = plugin_load('helper','statistics'); 396b6f8822SAndreas Gohr } 406b6f8822SAndreas Gohr 416b6f8822SAndreas Gohr /** 421878f16fSAndreas Gohr * Access for managers allowed 431878f16fSAndreas Gohr */ 446b6f8822SAndreas Gohr public function forAdminOnly(){ 451878f16fSAndreas Gohr return false; 461878f16fSAndreas Gohr } 471878f16fSAndreas Gohr 481878f16fSAndreas Gohr /** 491878f16fSAndreas Gohr * return sort order for position in admin menu 501878f16fSAndreas Gohr */ 516b6f8822SAndreas Gohr public function getMenuSort() { 526b6f8822SAndreas Gohr return 350; 531878f16fSAndreas Gohr } 541878f16fSAndreas Gohr 551878f16fSAndreas Gohr /** 561878f16fSAndreas Gohr * handle user request 571878f16fSAndreas Gohr */ 586b6f8822SAndreas Gohr public function handle() { 59264f1744SAndreas Gohr $this->opt = preg_replace('/[^a-z]+/','',$_REQUEST['opt']); 60a901d721SAndreas Gohr if(!in_array($this->opt,$this->pages)) $this->opt = 'dashboard'; 61a901d721SAndreas Gohr 6295eb68e6SAndreas Gohr $this->start = (int) $_REQUEST['s']; 63e8699bceSAndreas Gohr $this->setTimeframe($_REQUEST['f'],$_REQUEST['t']); 64e8699bceSAndreas Gohr } 6595eb68e6SAndreas Gohr 66e8699bceSAndreas Gohr /** 67e8699bceSAndreas Gohr * set limit clause 68e8699bceSAndreas Gohr */ 696b6f8822SAndreas Gohr public function setTimeframe($from,$to){ 70264f1744SAndreas Gohr // fixme add better sanity checking here: 71e8699bceSAndreas Gohr $from = preg_replace('/[^\d\-]+/','',$from); 72e8699bceSAndreas Gohr $to = preg_replace('/[^\d\-]+/','',$to); 73e8699bceSAndreas Gohr if(!$from) $from = date('Y-m-d'); 74e8699bceSAndreas Gohr if(!$to) $to = date('Y-m-d'); 75264f1744SAndreas Gohr 76264f1744SAndreas Gohr //setup limit clause 772ee939eeSAndreas Gohr $tlimit = "A.dt >= '$from 00:00:00' AND A.dt <= '$to 23:59:59'"; 78e8699bceSAndreas Gohr $this->tlimit = $tlimit; 79e8699bceSAndreas Gohr $this->from = $from; 80e8699bceSAndreas Gohr $this->to = $to; 811878f16fSAndreas Gohr } 821878f16fSAndreas Gohr 831878f16fSAndreas Gohr /** 8479b4a855SAndreas Gohr * Output the Statistics 851878f16fSAndreas Gohr */ 861878f16fSAndreas Gohr function html() { 87264f1744SAndreas Gohr echo '<h1>Access Statistics</h1>'; 88264f1744SAndreas Gohr $this->html_timeselect(); 89264f1744SAndreas Gohr 9079b4a855SAndreas Gohr $method = 'html_'.$this->opt; 9179b4a855SAndreas Gohr if(method_exists($this,$method)){ 92a901d721SAndreas Gohr echo '<div class="plg_stats_'.$this->opt.'">'; 93a901d721SAndreas Gohr echo '<h2>'.$this->getLang($this->opt).'</h2>'; 9479b4a855SAndreas Gohr $this->$method(); 95a901d721SAndreas Gohr echo '</div>'; 9614d99ec0SAndreas Gohr } 9714d99ec0SAndreas Gohr } 9814d99ec0SAndreas Gohr 996b6f8822SAndreas Gohr /** 1006b6f8822SAndreas Gohr * Return the TOC 1016b6f8822SAndreas Gohr * 1026b6f8822SAndreas Gohr * @return array 1036b6f8822SAndreas Gohr */ 10447ffcf7dSAndreas Gohr function getTOC(){ 10547ffcf7dSAndreas Gohr $toc = array(); 106a901d721SAndreas Gohr foreach($this->pages as $page){ 10747ffcf7dSAndreas Gohr $toc[] = array( 10847ffcf7dSAndreas Gohr 'link' => '?do=admin&page=statistics&opt='.$page.'&f='.$this->from.'&t='.$this->to, 10947ffcf7dSAndreas Gohr 'title' => $this->getLang($page), 11047ffcf7dSAndreas Gohr 'level' => 1, 11147ffcf7dSAndreas Gohr 'type' => 'ul' 11247ffcf7dSAndreas Gohr ); 11347ffcf7dSAndreas Gohr } 11447ffcf7dSAndreas Gohr return $toc; 1159da6395dSAndreas Gohr } 1169da6395dSAndreas Gohr 1176b6f8822SAndreas Gohr /** 1186b6f8822SAndreas Gohr * Outputs pagination links 1196b6f8822SAndreas Gohr * 1206b6f8822SAndreas Gohr * @fixme does this still work? 1216b6f8822SAndreas Gohr * 1226b6f8822SAndreas Gohr * @param type $limit 1236b6f8822SAndreas Gohr * @param type $next 1246b6f8822SAndreas Gohr */ 1252507f8e0SAndreas Gohr function html_pager($limit,$next){ 1262507f8e0SAndreas Gohr echo '<div class="plg_stats_pager">'; 1272507f8e0SAndreas Gohr 1282507f8e0SAndreas Gohr if($this->start > 0){ 1292507f8e0SAndreas Gohr $go = max($this->start - $limit, 0); 1302507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$this->from.'&t='.$this->to.'&s='.$go.'" class="prev">previous page</a>'; 1312507f8e0SAndreas Gohr } 1322507f8e0SAndreas Gohr 1332507f8e0SAndreas Gohr if($next){ 1342507f8e0SAndreas Gohr $go = $this->start + $limit; 1352507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$this->from.'&t='.$this->to.'&s='.$go.'" class="next">next page</a>'; 1362507f8e0SAndreas Gohr } 1372507f8e0SAndreas Gohr echo '</div>'; 1382507f8e0SAndreas Gohr } 1392507f8e0SAndreas Gohr 140264f1744SAndreas Gohr /** 141264f1744SAndreas Gohr * Print the time selection menu 142264f1744SAndreas Gohr */ 14314d99ec0SAndreas Gohr function html_timeselect(){ 144264f1744SAndreas Gohr $now = date('Y-m-d'); 145264f1744SAndreas Gohr $yday = date('Y-m-d',time()-(60*60*24)); 146264f1744SAndreas Gohr $week = date('Y-m-d',time()-(60*60*24*7)); 147264f1744SAndreas Gohr $month = date('Y-m-d',time()-(60*60*24*30)); 14814d99ec0SAndreas Gohr 149264f1744SAndreas Gohr echo '<div class="plg_stats_timeselect">'; 150264f1744SAndreas Gohr echo '<span>Select the timeframe:</span>'; 151264f1744SAndreas Gohr echo '<ul>'; 152264f1744SAndreas Gohr 153264f1744SAndreas Gohr echo '<li>'; 1542507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$now.'&t='.$now.'">'; 155264f1744SAndreas Gohr echo 'today'; 156264f1744SAndreas Gohr echo '</a>'; 157264f1744SAndreas Gohr echo '</li>'; 158264f1744SAndreas Gohr 159264f1744SAndreas Gohr echo '<li>'; 1602507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$yday.'&t='.$yday.'">'; 161264f1744SAndreas Gohr echo 'yesterday'; 162264f1744SAndreas Gohr echo '</a>'; 163264f1744SAndreas Gohr echo '</li>'; 164264f1744SAndreas Gohr 165264f1744SAndreas Gohr echo '<li>'; 1662507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$week.'&t='.$now.'">'; 167264f1744SAndreas Gohr echo 'last 7 days'; 168264f1744SAndreas Gohr echo '</a>'; 169264f1744SAndreas Gohr echo '</li>'; 170264f1744SAndreas Gohr 171264f1744SAndreas Gohr echo '<li>'; 1722507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$month.'&t='.$now.'">'; 173264f1744SAndreas Gohr echo 'last 30 days'; 174264f1744SAndreas Gohr echo '</a>'; 175264f1744SAndreas Gohr echo '</li>'; 176264f1744SAndreas Gohr 177264f1744SAndreas Gohr echo '</ul>'; 178264f1744SAndreas Gohr 179264f1744SAndreas Gohr 180264f1744SAndreas Gohr echo '<form action="" method="get">'; 181264f1744SAndreas Gohr echo '<input type="hidden" name="do" value="admin" />'; 182264f1744SAndreas Gohr echo '<input type="hidden" name="page" value="statistics" />'; 183264f1744SAndreas Gohr echo '<input type="hidden" name="opt" value="'.$this->opt.'" />'; 184264f1744SAndreas Gohr echo '<input type="text" name="f" value="'.$this->from.'" class="edit" />'; 185264f1744SAndreas Gohr echo '<input type="text" name="t" value="'.$this->to.'" class="edit" />'; 186264f1744SAndreas Gohr echo '<input type="submit" value="go" class="button" />'; 18714d99ec0SAndreas Gohr echo '</form>'; 188264f1744SAndreas Gohr 189264f1744SAndreas Gohr echo '</div>'; 19014d99ec0SAndreas Gohr } 19114d99ec0SAndreas Gohr 19214d99ec0SAndreas Gohr 193f5f32cbfSAndreas Gohr /** 194f5f32cbfSAndreas Gohr * Print an introductionary screen 195f5f32cbfSAndreas Gohr */ 19614d99ec0SAndreas Gohr function html_dashboard(){ 1972812a751SAndreas Gohr echo '<p>This page gives you a quick overview on what is happening in your Wiki. For detailed lists 1982812a751SAndreas Gohr choose a topic from the list.</p>'; 1992812a751SAndreas Gohr 2002812a751SAndreas Gohr // general info 2012812a751SAndreas Gohr echo '<div class="plg_stats_top">'; 2026b6f8822SAndreas Gohr $result = $this->hlp->Query()->aggregate($this->tlimit); 2032812a751SAndreas Gohr echo '<ul>'; 204*7299bd6dSAndreas Gohr foreach(array('pageviews','sessions','visitors','users','logins','bouncerate','timespent','avgpages','newvisitors') as $name){ 205eabe0d07SAndreas Gohr echo '<li><div class="li">'.sprintf($this->getLang('dash_'.$name),$result[$name]).'</div></li>'; 206eabe0d07SAndreas Gohr } 2072812a751SAndreas Gohr echo '</ul>'; 2082812a751SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=trend&f='.$this->from.'&t='.$this->to.'" />'; 2092812a751SAndreas Gohr echo '</div>'; 2102812a751SAndreas Gohr 21114d99ec0SAndreas Gohr 21287d5e44bSAndreas Gohr // top pages today 213264f1744SAndreas Gohr echo '<div>'; 214264f1744SAndreas Gohr echo '<h2>Most popular pages</h2>'; 2156b6f8822SAndreas Gohr $result = $this->hlp->Query()->pages($this->tlimit,$this->start,15); 2162812a751SAndreas Gohr $this->html_resulttable($result); 2172507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=page&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 218264f1744SAndreas Gohr echo '</div>'; 21987d5e44bSAndreas Gohr 22087d5e44bSAndreas Gohr // top referer today 221264f1744SAndreas Gohr echo '<div>'; 222e7a2f1e0SAndreas Gohr echo '<h2>Newest incoming links</h2>'; 2236b6f8822SAndreas Gohr $result = $this->hlp->Query()->newreferer($this->tlimit,$this->start,15); 2242812a751SAndreas Gohr $this->html_resulttable($result); 2252507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=newreferer&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 226264f1744SAndreas Gohr echo '</div>'; 22754f6c432SAndreas Gohr 22829dea504SAndreas Gohr // top searches today 229264f1744SAndreas Gohr echo '<div>'; 23029dea504SAndreas Gohr echo '<h2>Top search phrases</h2>'; 2316b6f8822SAndreas Gohr $result = $this->hlp->Query()->searchphrases($this->tlimit,$this->start,15); 23229dea504SAndreas Gohr $this->html_resulttable($result); 23329dea504SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=searchphrases&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 234264f1744SAndreas Gohr echo '</div>'; 23514d99ec0SAndreas Gohr } 23614d99ec0SAndreas Gohr 237c67866d1SAndreas Gohr function html_countries(){ 238c67866d1SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=countries&f='.$this->from.'&t='.$this->to.'" />'; 2396b6f8822SAndreas Gohr $result = $this->hlp->Query()->countries($this->tlimit,$this->start,150); 2402507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2419da6395dSAndreas Gohr } 2429da6395dSAndreas Gohr 2439da6395dSAndreas Gohr function html_page(){ 2446b6f8822SAndreas Gohr $result = $this->hlp->Query()->pages($this->tlimit,$this->start,150); 2452507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2469da6395dSAndreas Gohr } 2479da6395dSAndreas Gohr 2484f41a2ccSAndreas Gohr function html_browsers(){ 2494f41a2ccSAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=browsers&f='.$this->from.'&t='.$this->to.'" />'; 2506b6f8822SAndreas Gohr $result = $this->hlp->Query()->browsers($this->tlimit,$this->start,150,true); 2512507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 25275fa767dSAndreas Gohr } 25375fa767dSAndreas Gohr 254bd4217d3SAndreas Gohr function html_os(){ 2556b6f8822SAndreas Gohr $result = $this->hlp->Query()->os($this->tlimit,$this->start,150,true); 2562507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 257bd4217d3SAndreas Gohr } 258bd4217d3SAndreas Gohr 2599da6395dSAndreas Gohr function html_referer(){ 2606b6f8822SAndreas Gohr $result = $this->hlp->Query()->aggregate($this->tlimit); 2612812a751SAndreas Gohr 2622812a751SAndreas Gohr $all = $result['search']+$result['external']+$result['direct']; 2632812a751SAndreas Gohr 26494023548SAndreas Gohr if($all){ 2652812a751SAndreas Gohr printf("<p>Of all %d external visits, %d (%.1f%%) were bookmarked (direct) accesses, 2662812a751SAndreas Gohr %d (%.1f%%) came from search engines and %d (%.1f%%) were referred through 2672812a751SAndreas Gohr links from other pages.</p>",$all,$result['direct'],(100*$result['direct']/$all), 2682812a751SAndreas Gohr $result['search'],(100*$result['search']/$all),$result['external'], 2692812a751SAndreas Gohr (100*$result['external']/$all)); 27094023548SAndreas Gohr } 2712812a751SAndreas Gohr 2726b6f8822SAndreas Gohr $result = $this->hlp->Query()->referer($this->tlimit,$this->start,150); 2732507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2749da6395dSAndreas Gohr } 2759da6395dSAndreas Gohr 276e7a2f1e0SAndreas Gohr function html_newreferer(){ 277e7a2f1e0SAndreas Gohr echo '<p>The following incoming links where first logged in the selected time frame, 278e7a2f1e0SAndreas Gohr and have never been seen before.</p>'; 279e7a2f1e0SAndreas Gohr 2806b6f8822SAndreas Gohr $result = $this->hlp->Query()->newreferer($this->tlimit,$this->start,150); 2812507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 282e7a2f1e0SAndreas Gohr } 283e7a2f1e0SAndreas Gohr 284e25286daSAndreas Gohr function html_outlinks(){ 2856b6f8822SAndreas Gohr $result = $this->hlp->Query()->outlinks($this->tlimit,$this->start,150); 286e25286daSAndreas Gohr $this->html_resulttable($result,'',150); 287e25286daSAndreas Gohr } 288e25286daSAndreas Gohr 28912dcdeccSAndreas Gohr function html_searchphrases(){ 2905bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchphrases(true,$this->tlimit,$this->start,150); 29112dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 29212dcdeccSAndreas Gohr } 29312dcdeccSAndreas Gohr 29412dcdeccSAndreas Gohr function html_searchwords(){ 2955bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchwords(true,$this->tlimit,$this->start,150); 2965bccfe87SAndreas Gohr $this->html_resulttable($result,'',150); 2975bccfe87SAndreas Gohr } 2985bccfe87SAndreas Gohr 2995bccfe87SAndreas Gohr function html_internalsearchphrases(){ 3005bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchphrases(false,$this->tlimit,$this->start,150); 3015bccfe87SAndreas Gohr $this->html_resulttable($result,'',150); 3025bccfe87SAndreas Gohr } 3035bccfe87SAndreas Gohr 3045bccfe87SAndreas Gohr function html_internalsearchwords(){ 3055bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchwords(false,$this->tlimit,$this->start,150); 30612dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 30712dcdeccSAndreas Gohr } 30812dcdeccSAndreas Gohr 30912dcdeccSAndreas Gohr function html_searchengines(){ 3106b6f8822SAndreas Gohr $result = $this->hlp->Query()->searchengines($this->tlimit,$this->start,150); 31112dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 31212dcdeccSAndreas Gohr } 31312dcdeccSAndreas Gohr 314e25286daSAndreas Gohr 315c73e16f1SAndreas Gohr function html_resolution(){ 3166b6f8822SAndreas Gohr $result = $this->hlp->Query()->resolution($this->tlimit,$this->start,150); 317c73e16f1SAndreas Gohr $this->html_resulttable($result,'',150); 318c73e16f1SAndreas Gohr 319c73e16f1SAndreas Gohr echo '<p>While the data above gives you some info about the resolution your visitors use, it does not tell you 320c73e16f1SAndreas Gohr much about about the real size of their browser windows. The graphic below shows the size distribution of 321c73e16f1SAndreas Gohr the view port (document area) of your visitor\'s browsers. Please note that this data can not be logged 322c73e16f1SAndreas Gohr in all browsers. Because users may resize their browser window while browsing your site the statistics may 323c73e16f1SAndreas Gohr be flawed. Take it with a grain of salt.</p>'; 324c73e16f1SAndreas Gohr 325c73e16f1SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=view&f='.$this->from.'&t='.$this->to.'" />'; 326c73e16f1SAndreas Gohr } 3279da6395dSAndreas Gohr 3289da6395dSAndreas Gohr 32914d99ec0SAndreas Gohr /** 33014d99ec0SAndreas Gohr * Display a result in a HTML table 33114d99ec0SAndreas Gohr */ 3322507f8e0SAndreas Gohr function html_resulttable($result,$header='',$pager=0){ 33314d99ec0SAndreas Gohr echo '<table>'; 3342812a751SAndreas Gohr if(is_array($header)){ 33514d99ec0SAndreas Gohr echo '<tr>'; 33614d99ec0SAndreas Gohr foreach($header as $h){ 33714d99ec0SAndreas Gohr echo '<th>'.hsc($h).'</th>'; 33814d99ec0SAndreas Gohr } 33914d99ec0SAndreas Gohr echo '</tr>'; 3402812a751SAndreas Gohr } 34114d99ec0SAndreas Gohr 3422507f8e0SAndreas Gohr $count = 0; 3432ee939eeSAndreas Gohr if(is_array($result)) foreach($result as $row){ 34414d99ec0SAndreas Gohr echo '<tr>'; 34514d99ec0SAndreas Gohr foreach($row as $k => $v){ 3462812a751SAndreas Gohr echo '<td class="plg_stats_X'.$k.'">'; 34714d99ec0SAndreas Gohr if($k == 'page'){ 34814d99ec0SAndreas Gohr echo '<a href="'.wl($v).'" class="wikilink1">'; 34914d99ec0SAndreas Gohr echo hsc($v); 35014d99ec0SAndreas Gohr echo '</a>'; 35114d99ec0SAndreas Gohr }elseif($k == 'url'){ 35254f6c432SAndreas Gohr $url = hsc($v); 35383b63546SAndreas Gohr $url = preg_replace('/^https?:\/\/(www\.)?/','',$url); 3542812a751SAndreas Gohr if(strlen($url) > 45){ 3552812a751SAndreas Gohr $url = substr($url,0,30).' … '.substr($url,-15); 35654f6c432SAndreas Gohr } 35714d99ec0SAndreas Gohr echo '<a href="'.$v.'" class="urlextern">'; 35854f6c432SAndreas Gohr echo $url; 35914d99ec0SAndreas Gohr echo '</a>'; 3605bccfe87SAndreas Gohr }elseif($k == 'ilookup'){ 3615bccfe87SAndreas Gohr echo '<a href="'.wl('',array('id'=>$v,'do'=>'search')).'">Search</a>'; 36229dea504SAndreas Gohr }elseif($k == 'lookup'){ 36329dea504SAndreas Gohr echo '<a href="http://www.google.com/search?q='.rawurlencode($v).'">'; 36429dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/google.png" alt="lookup in Google" border="0" />'; 36529dea504SAndreas Gohr echo '</a> '; 36629dea504SAndreas Gohr 36729dea504SAndreas Gohr echo '<a href="http://search.yahoo.com/search?p='.rawurlencode($v).'">'; 36829dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/yahoo.png" alt="lookup in Yahoo" border="0" />'; 36929dea504SAndreas Gohr echo '</a> '; 37029dea504SAndreas Gohr 37129dea504SAndreas Gohr echo '<a href="http://search.msn.com/results.aspx?q='.rawurlencode($v).'">'; 37229dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/msn.png" alt="lookup in MSN Live" border="0" />'; 37329dea504SAndreas Gohr echo '</a> '; 37429dea504SAndreas Gohr 37512dcdeccSAndreas Gohr }elseif($k == 'engine'){ 37612dcdeccSAndreas Gohr include_once(dirname(__FILE__).'/inc/search_engines.php'); 37712dcdeccSAndreas Gohr echo $SearchEnginesHashLib[$v]; 37875fa767dSAndreas Gohr }elseif($k == 'bflag'){ 3792998b1f6SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/browser/'.strtolower(preg_replace('/[^\w]+/','',$v)).'.png" alt="'.hsc($v).'" />'; 380bd4217d3SAndreas Gohr }elseif($k == 'osflag'){ 3812998b1f6SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/os/'.strtolower(preg_replace('/[^\w]+/','',$v)).'.png" alt="'.hsc($v).'" />'; 38275fa767dSAndreas Gohr }elseif($k == 'cflag'){ 38375fa767dSAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/flags/'.hsc($v).'.png" alt="'.hsc($v).'" width="18" height="12" />'; 38414d99ec0SAndreas Gohr }elseif($k == 'html'){ 38514d99ec0SAndreas Gohr echo $v; 38614d99ec0SAndreas Gohr }else{ 38714d99ec0SAndreas Gohr echo hsc($v); 38814d99ec0SAndreas Gohr } 38914d99ec0SAndreas Gohr echo '</td>'; 39014d99ec0SAndreas Gohr } 39114d99ec0SAndreas Gohr echo '</tr>'; 3922507f8e0SAndreas Gohr 3932507f8e0SAndreas Gohr if($pager && ($count == $pager)) break; 3942507f8e0SAndreas Gohr $count++; 39514d99ec0SAndreas Gohr } 39614d99ec0SAndreas Gohr echo '</table>'; 3972507f8e0SAndreas Gohr 3982507f8e0SAndreas Gohr if($pager) $this->html_pager($pager,count($result) > $pager); 3991878f16fSAndreas Gohr } 4001878f16fSAndreas Gohr 4011878f16fSAndreas Gohr} 402