1<?php
2require dirname(__FILE__) . '/Browscap.php';
3
4/**
5 * Overwrites some methods from the original upstream Browscap class
6 */
7class StatisticsBrowscap extends Browscap {
8
9    /**
10     * Defines our own cache locations and names
11     */
12    public function __construct() {
13        global $conf;
14        $this->cacheDir      = $conf['cachedir'] . '/';
15        $this->cacheFilename = 'browscap.ini.php';
16        $this->remoteIniUrl  = 'http://browscap.org/stream?q=Lite_PHP_BrowsCapINI';
17    }
18
19    /**
20     * Use DokuWiki's HTTP Clients for downloading
21     *
22     * @param string $url
23     * @throws Exception
24     * @return string
25     */
26    protected function _getRemoteData($url) {
27        $http = new DokuHTTPClient($url);
28        $file = $http->get($url);
29        if(!$file)
30            throw new Exception('Your server can\'t connect to external resources. Please update the file manually.');
31        return $file;
32    }
33}
34