1
0
Fork 0
mirror of https://github.com/Findus23/plugin-ExcludeCountries.git synced 2024-09-18 14:43:48 +02:00

quick test

This commit is contained in:
Lukas Winkler 2020-08-30 10:57:30 +02:00
commit 15e0aa2884
Signed by: lukas
GPG key ID: 54DE4D798D244853
9 changed files with 84 additions and 0 deletions

3
CHANGELOG.md Normal file
View file

@ -0,0 +1,3 @@
## Changelog
Here goes the changelog text.

36
ExcludeCountries.php Normal file
View file

@ -0,0 +1,36 @@
<?php
/**
* 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\ExcludeCountries;
use Piwik\Common;
use Piwik\Container\StaticContainer;
use Piwik\Plugins\UserCountry\LocationProvider;
use Piwik\Tracker\Request;
class ExcludeCountries extends \Piwik\Plugin
{
public function registerEvents() {
return [
"Tracker.isExcludedVisit" => "checkExcludedCountry",
];
}
public function checkExcludedCountry(&$excluded, Request $request) {
$logger = StaticContainer::getContainer()->get("Psr\Log\LoggerInterface");
$provider = LocationProvider::getProviderById(Common::getCurrentLocationProviderId());
$location = $provider->getLocation(["ip" => $request->getIp()]);
$countryCode = $location[LocationProvider::COUNTRY_CODE_KEY];
if (strtolower($countryCode) !== "de") {
$logger->debug("request excluded by ExcludeCountries plugin (" . $countryCode . ")");
$excluded = true;
}
}
}

6
README.md Normal file
View file

@ -0,0 +1,6 @@
# Matomo ExcludeCountries Plugin
## Description
Add your plugin description here.

2
config/config.php Normal file
View file

@ -0,0 +1,2 @@
<?php
return array();

2
config/tracker.php Normal file
View file

@ -0,0 +1,2 @@
<?php
return array();

5
docs/faq.md Normal file
View file

@ -0,0 +1,5 @@
## FAQ
__My question?__
My answer

1
docs/index.md Normal file
View file

@ -0,0 +1 @@
## Documentation

29
plugin.json Normal file
View file

@ -0,0 +1,29 @@
{
"name": "ExcludeCountries",
"description": "TODO",
"version": "0.1.0",
"theme": false,
"require": {
"piwik": ">=3.10.0,<4.0.0-b1"
},
"authors": [
{
"name": "Matomo",
"email": "",
"homepage": ""
}
],
"support": {
"email": "",
"issues": "",
"forum": "",
"irc": "",
"wiki": "",
"source": "",
"docs": "",
"rss": ""
},
"homepage": "",
"license": "GPL v3+",
"keywords": []
}

0
screenshots/.gitkeep Normal file
View file