-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathAPI.php
42 lines (35 loc) · 919 Bytes
/
API.php
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
<?php
/**
* Matomo - Open source web analytics
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @copyright (c) 2022 Joubert RedRat
* @author Joubert RedRat <eu+matomo@redrat.com.br>
* @license MIT
* @category Matomo_Plugins
* @package ProtectTrackID
*/
declare(strict_types=1);
namespace Piwik\Plugins\ProtectTrackID;
use Piwik\Piwik;
use Piwik\Plugin\API as PluginAPI;
/**
* API for plugin ProtectTrackID
*
* @method static \Piwik\Plugins\ProtectTrackID\API getInstance()
*/
class API extends PluginAPI
{
public function getHashedId(int $idSite)
{
Piwik::checkUserHasSomeViewAccess();
$settings = PluginSettings::createFromSettings();
if (!$settings->hasValidValues()) {
return $idSite;
}
$hasher = new Hasher($settings);
return $hasher->encode((string) $idSite);
}
}