-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIP2Proxy.php
More file actions
83 lines (75 loc) · 1.72 KB
/
IP2Proxy.php
File metadata and controls
83 lines (75 loc) · 1.72 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Plugin Name: IP2Proxy (Matomo Plugin)
* Plugin URI: http://plugins.matomo.org/ip2proxy
* Description: Get the proxy details of visitors to your website.
* Author: IP2Location
* Author URI: https://github.com/ip2location/ip2proxy-matomo
* Version: 0.1.6.
*/
?><?php
/**
* Piwik - free/libre analytics platform.
*
* @see https://matomo.org
*
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\IP2Proxy;
use Piwik\SettingsPiwik;
use Piwik\Widget\WidgetsList;
if (\defined('ABSPATH')
&& \function_exists('add_action')) {
$path = '/matomo/app/core/Plugin.php';
if (\defined('WP_PLUGIN_DIR') && WP_PLUGIN_DIR && file_exists(WP_PLUGIN_DIR . $path)) {
require_once WP_PLUGIN_DIR . $path;
} elseif (\defined('WPMU_PLUGIN_DIR') && WPMU_PLUGIN_DIR && file_exists(WPMU_PLUGIN_DIR . $path)) {
require_once WPMU_PLUGIN_DIR . $path;
} else {
return;
}
add_action('plugins_loaded', function () {
if (\function_exists('matomo_add_plugin')) {
matomo_add_plugin(__DIR__, __FILE__, true);
}
});
}
class IP2Proxy extends \Piwik\Plugin
{
/**
* @see https://developer.matomo.org/guides/extending-database
*/
public function install()
{
}
/**
* @see https://developer.matomo.org/guides/extending-database
*/
public function activate()
{
}
/**
* @see https://developer.matomo.org/guides/extending-database
*/
public function uninstall()
{
}
/**
* @see \Piwik\Plugin::registerEvents
*/
public function registerEvents()
{
return [
'Widget.filterWidgets' => 'filterWidgets',
];
}
/**
* @param WidgetsList $list
*/
public function filterWidgets($list)
{
if (!SettingsPiwik::isInternetEnabled()) {
$list->remove('IP2Proxy_ProxyDetails');
}
}
}