From 15e0aa28846fc740396c1ce30ca90a2ade43fe8a Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Sun, 30 Aug 2020 10:57:30 +0200 Subject: [PATCH] quick test --- CHANGELOG.md | 3 +++ ExcludeCountries.php | 36 ++++++++++++++++++++++++++++++++++++ README.md | 6 ++++++ config/config.php | 2 ++ config/tracker.php | 2 ++ docs/faq.md | 5 +++++ docs/index.md | 1 + plugin.json | 29 +++++++++++++++++++++++++++++ screenshots/.gitkeep | 0 9 files changed, 84 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 ExcludeCountries.php create mode 100644 README.md create mode 100644 config/config.php create mode 100644 config/tracker.php create mode 100644 docs/faq.md create mode 100644 docs/index.md create mode 100644 plugin.json create mode 100644 screenshots/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8546318 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## Changelog + +Here goes the changelog text. diff --git a/ExcludeCountries.php b/ExcludeCountries.php new file mode 100644 index 0000000..df07c94 --- /dev/null +++ b/ExcludeCountries.php @@ -0,0 +1,36 @@ + "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; + } + } + +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..55f2995 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Matomo ExcludeCountries Plugin + +## Description + +Add your plugin description here. + diff --git a/config/config.php b/config/config.php new file mode 100644 index 0000000..d266508 --- /dev/null +++ b/config/config.php @@ -0,0 +1,2 @@ +=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": [] +} diff --git a/screenshots/.gitkeep b/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29