Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Visitor.php « DevicePlugins « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 501e241a50960e0632d79600eaf788af4dcbe4f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 */
namespace Piwik\Plugins\DevicePlugins;

require_once PIWIK_INCLUDE_PATH . '/plugins/DevicePlugins/functions.php';

class Visitor
{
    const DELIMITER_PLUGIN_NAME = ", ";

    private $details = array();

    public function __construct($details)
    {
        $this->details = $details;
    }

    function getPlugins()
    {
        $plugins = array(
            'config_pdf',
            'config_flash',
            'config_java',
            'config_director',
            'config_quicktime',
            'config_realplayer',
            'config_windowsmedia',
            'config_gears',
            'config_silverlight',
        );
        $pluginShortNames = array();

        foreach ($plugins as $plugin) {
            if (array_key_exists($plugin, $this->details) && $this->details[$plugin] == 1) {
                $pluginShortName    = substr($plugin, 7);
                $pluginShortNames[] = $pluginShortName;
            }
        }

        return implode(self::DELIMITER_PLUGIN_NAME, $pluginShortNames);
    }

    function getPluginIcons()
    {
        $pluginNames = $this->getPlugins();
        if (!empty($pluginNames)) {
            $pluginNames = explode(self::DELIMITER_PLUGIN_NAME, $pluginNames);
            $pluginIcons = array();

            foreach ($pluginNames as $plugin) {
                $pluginIcons[] = array("pluginIcon" => getPluginsLogo($plugin), "pluginName" => $plugin);
            }

            return $pluginIcons;
        }

        return null;
    }
}