Download plugins/AnonymousPiwikUsageMeasurement/Tracker/Targets.php from Leon4gr45/matomo: direct link, hf CLI and curl.
- Browser
- Download file 1.86 kB
-
https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/AnonymousPiwikUsageMeasurement/Tracker/Targets.php
- Command line
-
hf download hf://spaces/Leon4gr45/matomo/plugins/AnonymousPiwikUsageMeasurement/Tracker/Targets.php
-
curl -L -o Targets.php https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/AnonymousPiwikUsageMeasurement/Tracker/Targets.php
1.86 kB
| /** | |
| * Matomo - free/libre analytics platform | |
| * | |
| * @link https://matomo.org | |
| * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | |
| */ | |
| namespace Piwik\Plugins\AnonymousPiwikUsageMeasurement\Tracker; | |
| use Piwik\Common; | |
| use Piwik\Plugins\AnonymousPiwikUsageMeasurement\SystemSettings; | |
| use Piwik\SettingsPiwik; | |
| use Piwik\Tests\Framework\Fixture; | |
| /** | |
| * Defines Settings for AnonymousPiwikUsageMeasurement. | |
| */ | |
| class Targets | |
| { | |
| /** | |
| * @var SystemSettings | |
| */ | |
| private $settings; | |
| public function __construct(SystemSettings $settings) | |
| { | |
| $this->settings = $settings; | |
| } | |
| public function getTargets() | |
| { | |
| $targets = array(); | |
| $ownSiteId = $this->settings->ownPiwikSiteId->getValue(); | |
| if ($ownSiteId) { | |
| $piwikUrl = SettingsPiwik::getPiwikUrl(); | |
| if (!Common::stringEndsWith($piwikUrl, '/')) { | |
| $piwikUrl .= '/'; | |
| } | |
| $targets[] = array( | |
| 'url' => $piwikUrl . 'matomo.php', | |
| 'idSite' => (int) $ownSiteId, | |
| 'useAnonymization' => $this->settings->anonymizeSelfPiwik->getValue() | |
| ); | |
| } | |
| $customUrl = $this->settings->customPiwikSiteUrl->getValue(); | |
| $customSiteId = $this->settings->customPiwikSiteId->getValue(); | |
| if ($customUrl && $customSiteId) { | |
| $targets[] = array( | |
| 'url' => $customUrl, | |
| 'idSite' => (int) $customSiteId, | |
| 'useAnonymization' => $this->settings->anonymizeCustomPiwik->getValue() | |
| ); | |
| } | |
| if (defined('PIWIK_TEST_MODE') && PIWIK_TEST_MODE && Common::isPhpCliMode()) { | |
| foreach ($targets as &$target) { | |
| $target['token_auth'] = Fixture::getTokenAuth(); | |
| } | |
| } | |
| return $targets; | |
| } | |
| } | |