mirror of
https://github.com/Findus23/plugin-ExcludeCountries.git
synced 2024-09-19 15:53:47 +02:00
quick test
This commit is contained in:
commit
15e0aa2884
9 changed files with 84 additions and 0 deletions
3
CHANGELOG.md
Normal file
3
CHANGELOG.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
Here goes the changelog text.
|
36
ExcludeCountries.php
Normal file
36
ExcludeCountries.php
Normal 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
6
README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Matomo ExcludeCountries Plugin
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
Add your plugin description here.
|
||||||
|
|
2
config/config.php
Normal file
2
config/config.php
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
return array();
|
2
config/tracker.php
Normal file
2
config/tracker.php
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
return array();
|
5
docs/faq.md
Normal file
5
docs/faq.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
__My question?__
|
||||||
|
|
||||||
|
My answer
|
1
docs/index.md
Normal file
1
docs/index.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
## Documentation
|
29
plugin.json
Normal file
29
plugin.json
Normal 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
0
screenshots/.gitkeep
Normal file
Loading…
Reference in a new issue