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() { 871d2d78ccSAndreas Gohr echo '<div id="plugin__statistics">'; 88264f1744SAndreas Gohr echo '<h1>Access Statistics</h1>'; 89264f1744SAndreas Gohr $this->html_timeselect(); 90264f1744SAndreas Gohr 9179b4a855SAndreas Gohr $method = 'html_'.$this->opt; 9279b4a855SAndreas Gohr if(method_exists($this,$method)){ 93a901d721SAndreas Gohr echo '<div class="plg_stats_'.$this->opt.'">'; 94a901d721SAndreas Gohr echo '<h2>'.$this->getLang($this->opt).'</h2>'; 9579b4a855SAndreas Gohr $this->$method(); 96a901d721SAndreas Gohr echo '</div>'; 9714d99ec0SAndreas Gohr } 981d2d78ccSAndreas Gohr echo '</div>'; 9914d99ec0SAndreas Gohr } 10014d99ec0SAndreas Gohr 1016b6f8822SAndreas Gohr /** 1026b6f8822SAndreas Gohr * Return the TOC 1036b6f8822SAndreas Gohr * 1046b6f8822SAndreas Gohr * @return array 1056b6f8822SAndreas Gohr */ 10647ffcf7dSAndreas Gohr function getTOC(){ 10747ffcf7dSAndreas Gohr $toc = array(); 108a901d721SAndreas Gohr foreach($this->pages as $page){ 10947ffcf7dSAndreas Gohr $toc[] = array( 11047ffcf7dSAndreas Gohr 'link' => '?do=admin&page=statistics&opt='.$page.'&f='.$this->from.'&t='.$this->to, 11147ffcf7dSAndreas Gohr 'title' => $this->getLang($page), 11247ffcf7dSAndreas Gohr 'level' => 1, 11347ffcf7dSAndreas Gohr 'type' => 'ul' 11447ffcf7dSAndreas Gohr ); 11547ffcf7dSAndreas Gohr } 11647ffcf7dSAndreas Gohr return $toc; 1179da6395dSAndreas Gohr } 1189da6395dSAndreas Gohr 119*dc7b1e5eSAndreas Gohr 120*dc7b1e5eSAndreas Gohr function html_graph($name,$width,$height){ 121*dc7b1e5eSAndreas Gohr $url = DOKU_BASE.'lib/plugins/statistics/img.php?img='.$name. 122*dc7b1e5eSAndreas Gohr '&f='.$this->from.'&t='.$this->to; 123*dc7b1e5eSAndreas Gohr echo '<img src="'.$url.'" class="graph" width="'.$width.'" height="'.$height.'"/>'; 124*dc7b1e5eSAndreas Gohr } 125*dc7b1e5eSAndreas Gohr 126*dc7b1e5eSAndreas Gohr 1276b6f8822SAndreas Gohr /** 1286b6f8822SAndreas Gohr * Outputs pagination links 1296b6f8822SAndreas Gohr * 1306b6f8822SAndreas Gohr * @fixme does this still work? 1316b6f8822SAndreas Gohr * 1326b6f8822SAndreas Gohr * @param type $limit 1336b6f8822SAndreas Gohr * @param type $next 1346b6f8822SAndreas Gohr */ 1352507f8e0SAndreas Gohr function html_pager($limit,$next){ 1362507f8e0SAndreas Gohr echo '<div class="plg_stats_pager">'; 1372507f8e0SAndreas Gohr 1382507f8e0SAndreas Gohr if($this->start > 0){ 1392507f8e0SAndreas Gohr $go = max($this->start - $limit, 0); 1402507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$this->from.'&t='.$this->to.'&s='.$go.'" class="prev">previous page</a>'; 1412507f8e0SAndreas Gohr } 1422507f8e0SAndreas Gohr 1432507f8e0SAndreas Gohr if($next){ 1442507f8e0SAndreas Gohr $go = $this->start + $limit; 1452507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$this->from.'&t='.$this->to.'&s='.$go.'" class="next">next page</a>'; 1462507f8e0SAndreas Gohr } 1472507f8e0SAndreas Gohr echo '</div>'; 1482507f8e0SAndreas Gohr } 1492507f8e0SAndreas Gohr 150264f1744SAndreas Gohr /** 151264f1744SAndreas Gohr * Print the time selection menu 152264f1744SAndreas Gohr */ 15314d99ec0SAndreas Gohr function html_timeselect(){ 1546985b606SAndreas Gohr $today = date('Y-m-d'); 1556985b606SAndreas Gohr $last1 = date('Y-m-d',time()-(60*60*24)); 1566985b606SAndreas Gohr $last7 = date('Y-m-d',time()-(60*60*24*7)); 1576985b606SAndreas Gohr $last30 = date('Y-m-d',time()-(60*60*24*30)); 15814d99ec0SAndreas Gohr 159264f1744SAndreas Gohr echo '<div class="plg_stats_timeselect">'; 1606985b606SAndreas Gohr echo '<span>'.$this->getLang('time_select').'</span> '; 161264f1744SAndreas Gohr 162264f1744SAndreas Gohr echo '<form action="" method="get">'; 163264f1744SAndreas Gohr echo '<input type="hidden" name="do" value="admin" />'; 164264f1744SAndreas Gohr echo '<input type="hidden" name="page" value="statistics" />'; 165264f1744SAndreas Gohr echo '<input type="hidden" name="opt" value="'.$this->opt.'" />'; 166264f1744SAndreas Gohr echo '<input type="text" name="f" value="'.$this->from.'" class="edit" />'; 167264f1744SAndreas Gohr echo '<input type="text" name="t" value="'.$this->to.'" class="edit" />'; 168264f1744SAndreas Gohr echo '<input type="submit" value="go" class="button" />'; 16914d99ec0SAndreas Gohr echo '</form>'; 170264f1744SAndreas Gohr 1716985b606SAndreas Gohr echo '<ul>'; 1726985b606SAndreas Gohr foreach(array('today','last1','last7','last30') as $time){ 1736985b606SAndreas Gohr echo '<li>'; 1746985b606SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$$time.'&t='.$today.'">'; 1756985b606SAndreas Gohr echo $this->getLang('time_'.$time); 1766985b606SAndreas Gohr echo '</a>'; 1776985b606SAndreas Gohr echo '</li>'; 1786985b606SAndreas Gohr } 1796985b606SAndreas Gohr echo '</ul>'; 1806985b606SAndreas Gohr 181264f1744SAndreas Gohr echo '</div>'; 18214d99ec0SAndreas Gohr } 18314d99ec0SAndreas Gohr 18414d99ec0SAndreas Gohr 185f5f32cbfSAndreas Gohr /** 186f5f32cbfSAndreas Gohr * Print an introductionary screen 187f5f32cbfSAndreas Gohr */ 18814d99ec0SAndreas Gohr function html_dashboard(){ 189*dc7b1e5eSAndreas Gohr echo $this->locale_xhtml('dashboard'); 1902812a751SAndreas Gohr 1912812a751SAndreas Gohr // general info 1922812a751SAndreas Gohr echo '<div class="plg_stats_top">'; 1936b6f8822SAndreas Gohr $result = $this->hlp->Query()->aggregate($this->tlimit); 1941d2d78ccSAndreas Gohr 1951d2d78ccSAndreas Gohr echo '<ul class="left">'; 1961d2d78ccSAndreas Gohr foreach(array('pageviews','sessions','visitors','users','logins') as $name){ 197eabe0d07SAndreas Gohr echo '<li><div class="li">'.sprintf($this->getLang('dash_'.$name),$result[$name]).'</div></li>'; 198eabe0d07SAndreas Gohr } 1992812a751SAndreas Gohr echo '</ul>'; 2001d2d78ccSAndreas Gohr 2011d2d78ccSAndreas Gohr echo '<ul class="left">'; 2021d2d78ccSAndreas Gohr foreach(array('bouncerate','timespent','avgpages','newvisitors','registrations') as $name){ 2031d2d78ccSAndreas Gohr echo '<li><div class="li">'.sprintf($this->getLang('dash_'.$name),$result[$name]).'</div></li>'; 2041d2d78ccSAndreas Gohr } 2051d2d78ccSAndreas Gohr echo '</ul>'; 2061d2d78ccSAndreas Gohr 207*dc7b1e5eSAndreas Gohr $this->html_graph('trend',700,280); 2082812a751SAndreas Gohr echo '</div>'; 2092812a751SAndreas Gohr 21014d99ec0SAndreas Gohr 21187d5e44bSAndreas Gohr // top pages today 212264f1744SAndreas Gohr echo '<div>'; 213*dc7b1e5eSAndreas Gohr echo '<h2>'.$this->getLang('dash_mostpopular').'</h2>'; 2146b6f8822SAndreas Gohr $result = $this->hlp->Query()->pages($this->tlimit,$this->start,15); 2152812a751SAndreas Gohr $this->html_resulttable($result); 2162507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=page&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 217264f1744SAndreas Gohr echo '</div>'; 21887d5e44bSAndreas Gohr 21987d5e44bSAndreas Gohr // top referer today 220264f1744SAndreas Gohr echo '<div>'; 221*dc7b1e5eSAndreas Gohr echo '<h2>'.$this->getLang('dash_newincoming').'</h2>'; 2226b6f8822SAndreas Gohr $result = $this->hlp->Query()->newreferer($this->tlimit,$this->start,15); 2232812a751SAndreas Gohr $this->html_resulttable($result); 2242507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=newreferer&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 225264f1744SAndreas Gohr echo '</div>'; 22654f6c432SAndreas Gohr 22729dea504SAndreas Gohr // top searches today 228264f1744SAndreas Gohr echo '<div>'; 229*dc7b1e5eSAndreas Gohr echo '<h2>'.$this->getLang('dash_topsearch').'</h2>'; 2306b6f8822SAndreas Gohr $result = $this->hlp->Query()->searchphrases($this->tlimit,$this->start,15); 23129dea504SAndreas Gohr $this->html_resulttable($result); 23229dea504SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=searchphrases&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 233264f1744SAndreas Gohr echo '</div>'; 23414d99ec0SAndreas Gohr } 23514d99ec0SAndreas Gohr 236c67866d1SAndreas Gohr function html_countries(){ 237c67866d1SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=countries&f='.$this->from.'&t='.$this->to.'" />'; 2386b6f8822SAndreas Gohr $result = $this->hlp->Query()->countries($this->tlimit,$this->start,150); 2392507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2409da6395dSAndreas Gohr } 2419da6395dSAndreas Gohr 2429da6395dSAndreas Gohr function html_page(){ 2436b6f8822SAndreas Gohr $result = $this->hlp->Query()->pages($this->tlimit,$this->start,150); 2442507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2459da6395dSAndreas Gohr } 2469da6395dSAndreas Gohr 2474f41a2ccSAndreas Gohr function html_browsers(){ 2484f41a2ccSAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=browsers&f='.$this->from.'&t='.$this->to.'" />'; 2496b6f8822SAndreas Gohr $result = $this->hlp->Query()->browsers($this->tlimit,$this->start,150,true); 2502507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 25175fa767dSAndreas Gohr } 25275fa767dSAndreas Gohr 253bd4217d3SAndreas Gohr function html_os(){ 2546b6f8822SAndreas Gohr $result = $this->hlp->Query()->os($this->tlimit,$this->start,150,true); 2552507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 256bd4217d3SAndreas Gohr } 257bd4217d3SAndreas Gohr 2589da6395dSAndreas Gohr function html_referer(){ 2596b6f8822SAndreas Gohr $result = $this->hlp->Query()->aggregate($this->tlimit); 2602812a751SAndreas Gohr 2612812a751SAndreas Gohr $all = $result['search']+$result['external']+$result['direct']; 2622812a751SAndreas Gohr 26394023548SAndreas Gohr if($all){ 2642812a751SAndreas Gohr printf("<p>Of all %d external visits, %d (%.1f%%) were bookmarked (direct) accesses, 2652812a751SAndreas Gohr %d (%.1f%%) came from search engines and %d (%.1f%%) were referred through 2662812a751SAndreas Gohr links from other pages.</p>",$all,$result['direct'],(100*$result['direct']/$all), 2672812a751SAndreas Gohr $result['search'],(100*$result['search']/$all),$result['external'], 2682812a751SAndreas Gohr (100*$result['external']/$all)); 26994023548SAndreas Gohr } 2702812a751SAndreas Gohr 2716b6f8822SAndreas Gohr $result = $this->hlp->Query()->referer($this->tlimit,$this->start,150); 2722507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2739da6395dSAndreas Gohr } 2749da6395dSAndreas Gohr 275e7a2f1e0SAndreas Gohr function html_newreferer(){ 276e7a2f1e0SAndreas Gohr echo '<p>The following incoming links where first logged in the selected time frame, 277e7a2f1e0SAndreas Gohr and have never been seen before.</p>'; 278e7a2f1e0SAndreas Gohr 2796b6f8822SAndreas Gohr $result = $this->hlp->Query()->newreferer($this->tlimit,$this->start,150); 2802507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 281e7a2f1e0SAndreas Gohr } 282e7a2f1e0SAndreas Gohr 283e25286daSAndreas Gohr function html_outlinks(){ 2846b6f8822SAndreas Gohr $result = $this->hlp->Query()->outlinks($this->tlimit,$this->start,150); 285e25286daSAndreas Gohr $this->html_resulttable($result,'',150); 286e25286daSAndreas Gohr } 287e25286daSAndreas Gohr 28812dcdeccSAndreas Gohr function html_searchphrases(){ 2895bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchphrases(true,$this->tlimit,$this->start,150); 29012dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 29112dcdeccSAndreas Gohr } 29212dcdeccSAndreas Gohr 29312dcdeccSAndreas Gohr function html_searchwords(){ 2945bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchwords(true,$this->tlimit,$this->start,150); 2955bccfe87SAndreas Gohr $this->html_resulttable($result,'',150); 2965bccfe87SAndreas Gohr } 2975bccfe87SAndreas Gohr 2985bccfe87SAndreas Gohr function html_internalsearchphrases(){ 2995bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchphrases(false,$this->tlimit,$this->start,150); 3005bccfe87SAndreas Gohr $this->html_resulttable($result,'',150); 3015bccfe87SAndreas Gohr } 3025bccfe87SAndreas Gohr 3035bccfe87SAndreas Gohr function html_internalsearchwords(){ 3045bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchwords(false,$this->tlimit,$this->start,150); 30512dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 30612dcdeccSAndreas Gohr } 30712dcdeccSAndreas Gohr 30812dcdeccSAndreas Gohr function html_searchengines(){ 3096b6f8822SAndreas Gohr $result = $this->hlp->Query()->searchengines($this->tlimit,$this->start,150); 31012dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 31112dcdeccSAndreas Gohr } 31212dcdeccSAndreas Gohr 313e25286daSAndreas Gohr 314c73e16f1SAndreas Gohr function html_resolution(){ 315307baf3fSAndreas Gohr 316307baf3fSAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=resolution&f='.$this->from.'&t='.$this->to.'" />'; 317c73e16f1SAndreas Gohr 318c73e16f1SAndreas Gohr echo '<p>While the data above gives you some info about the resolution your visitors use, it does not tell you 319c73e16f1SAndreas Gohr much about about the real size of their browser windows. The graphic below shows the size distribution of 320c73e16f1SAndreas Gohr the view port (document area) of your visitor\'s browsers. Please note that this data can not be logged 321c73e16f1SAndreas Gohr in all browsers. Because users may resize their browser window while browsing your site the statistics may 322c73e16f1SAndreas Gohr be flawed. Take it with a grain of salt.</p>'; 323c73e16f1SAndreas Gohr 324307baf3fSAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=viewport&f='.$this->from.'&t='.$this->to.'" />'; 325307baf3fSAndreas Gohr 326307baf3fSAndreas Gohr $result = $this->hlp->Query()->resolution($this->tlimit,$this->start,150); 327307baf3fSAndreas Gohr $this->html_resulttable($result,'',150); 328307baf3fSAndreas Gohr 329307baf3fSAndreas Gohr 330c73e16f1SAndreas Gohr } 3319da6395dSAndreas Gohr 3329da6395dSAndreas Gohr 33314d99ec0SAndreas Gohr /** 33414d99ec0SAndreas Gohr * Display a result in a HTML table 33514d99ec0SAndreas Gohr */ 3362507f8e0SAndreas Gohr function html_resulttable($result,$header='',$pager=0){ 33714d99ec0SAndreas Gohr echo '<table>'; 3382812a751SAndreas Gohr if(is_array($header)){ 33914d99ec0SAndreas Gohr echo '<tr>'; 34014d99ec0SAndreas Gohr foreach($header as $h){ 34114d99ec0SAndreas Gohr echo '<th>'.hsc($h).'</th>'; 34214d99ec0SAndreas Gohr } 34314d99ec0SAndreas Gohr echo '</tr>'; 3442812a751SAndreas Gohr } 34514d99ec0SAndreas Gohr 3462507f8e0SAndreas Gohr $count = 0; 3472ee939eeSAndreas Gohr if(is_array($result)) foreach($result as $row){ 34814d99ec0SAndreas Gohr echo '<tr>'; 34914d99ec0SAndreas Gohr foreach($row as $k => $v){ 3502812a751SAndreas Gohr echo '<td class="plg_stats_X'.$k.'">'; 35114d99ec0SAndreas Gohr if($k == 'page'){ 35214d99ec0SAndreas Gohr echo '<a href="'.wl($v).'" class="wikilink1">'; 35314d99ec0SAndreas Gohr echo hsc($v); 35414d99ec0SAndreas Gohr echo '</a>'; 35514d99ec0SAndreas Gohr }elseif($k == 'url'){ 35654f6c432SAndreas Gohr $url = hsc($v); 35783b63546SAndreas Gohr $url = preg_replace('/^https?:\/\/(www\.)?/','',$url); 3582812a751SAndreas Gohr if(strlen($url) > 45){ 3592812a751SAndreas Gohr $url = substr($url,0,30).' … '.substr($url,-15); 36054f6c432SAndreas Gohr } 36114d99ec0SAndreas Gohr echo '<a href="'.$v.'" class="urlextern">'; 36254f6c432SAndreas Gohr echo $url; 36314d99ec0SAndreas Gohr echo '</a>'; 3645bccfe87SAndreas Gohr }elseif($k == 'ilookup'){ 3655bccfe87SAndreas Gohr echo '<a href="'.wl('',array('id'=>$v,'do'=>'search')).'">Search</a>'; 36629dea504SAndreas Gohr }elseif($k == 'lookup'){ 36729dea504SAndreas Gohr echo '<a href="http://www.google.com/search?q='.rawurlencode($v).'">'; 36829dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/google.png" alt="lookup in Google" border="0" />'; 36929dea504SAndreas Gohr echo '</a> '; 37029dea504SAndreas Gohr 37129dea504SAndreas Gohr echo '<a href="http://search.yahoo.com/search?p='.rawurlencode($v).'">'; 37229dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/yahoo.png" alt="lookup in Yahoo" border="0" />'; 37329dea504SAndreas Gohr echo '</a> '; 37429dea504SAndreas Gohr 37529dea504SAndreas Gohr echo '<a href="http://search.msn.com/results.aspx?q='.rawurlencode($v).'">'; 37629dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/msn.png" alt="lookup in MSN Live" border="0" />'; 37729dea504SAndreas Gohr echo '</a> '; 37829dea504SAndreas Gohr 37912dcdeccSAndreas Gohr }elseif($k == 'engine'){ 38012dcdeccSAndreas Gohr include_once(dirname(__FILE__).'/inc/search_engines.php'); 38112dcdeccSAndreas Gohr echo $SearchEnginesHashLib[$v]; 38275fa767dSAndreas Gohr }elseif($k == 'bflag'){ 3832998b1f6SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/browser/'.strtolower(preg_replace('/[^\w]+/','',$v)).'.png" alt="'.hsc($v).'" />'; 384bd4217d3SAndreas Gohr }elseif($k == 'osflag'){ 3852998b1f6SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/os/'.strtolower(preg_replace('/[^\w]+/','',$v)).'.png" alt="'.hsc($v).'" />'; 38675fa767dSAndreas Gohr }elseif($k == 'cflag'){ 38775fa767dSAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/flags/'.hsc($v).'.png" alt="'.hsc($v).'" width="18" height="12" />'; 38814d99ec0SAndreas Gohr }elseif($k == 'html'){ 38914d99ec0SAndreas Gohr echo $v; 39014d99ec0SAndreas Gohr }else{ 39114d99ec0SAndreas Gohr echo hsc($v); 39214d99ec0SAndreas Gohr } 39314d99ec0SAndreas Gohr echo '</td>'; 39414d99ec0SAndreas Gohr } 39514d99ec0SAndreas Gohr echo '</tr>'; 3962507f8e0SAndreas Gohr 3972507f8e0SAndreas Gohr if($pager && ($count == $pager)) break; 3982507f8e0SAndreas Gohr $count++; 39914d99ec0SAndreas Gohr } 40014d99ec0SAndreas Gohr echo '</table>'; 4012507f8e0SAndreas Gohr 4022507f8e0SAndreas Gohr if($pager) $this->html_pager($pager,count($result) > $pager); 4031878f16fSAndreas Gohr } 4041878f16fSAndreas Gohr 4051878f16fSAndreas Gohr} 406