commit 40d1e7bbd9c0fd6d0ac77900bd8e446f03440c9c Author: Lukas Winkler Date: Fri Feb 21 21:46:39 2020 +0100 initial commit diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..11bb4fe --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## Changelog + +# 0.1.0 + +first beta version diff --git a/Controller.php b/Controller.php new file mode 100644 index 0000000..2ef008f --- /dev/null +++ b/Controller.php @@ -0,0 +1,47 @@ + $message, "options" => ["title" => "QuickExcludeVisitorIP", "context" => $type]]); + } + + public function ignoreIP() + { + Piwik::checkUserHasSuperUserAccess(); + @header('Content-Type: application/json; charset=utf-8'); + $ip = Common::getRequestVar('ip', null, 'string'); + $ignoredIPstr = APISitesManager::getInstance()->getExcludedIpsGlobal(); + $ignoredIPs = explode(",", $ignoredIPstr); + if (in_array($ip, $ignoredIPs)) { + return $this->response("IP was already on ignore list", "warning"); + } + + $ignoredIPs[] = $ip; + + $ignoredIPstr = implode(",", $ignoredIPs); + + APISitesManager::getInstance()->setGlobalExcludedIps($ignoredIPstr); + + return $this->response("successfully added \"$ip\" to ignore list", "success"); + } +} diff --git a/QuickExcludeVisitorIP.php b/QuickExcludeVisitorIP.php new file mode 100644 index 0000000..5e2badc --- /dev/null +++ b/QuickExcludeVisitorIP.php @@ -0,0 +1,37 @@ + 'handleMyEventInATemplate', + 'AssetManager.getJavaScriptFiles' => 'getJavaScriptFiles', + ); + } + + public function handleMyEventInATemplate(&$outString, Row $visit) + { + if (Access::getInstance()->hasSuperUserAccess()) { + $ip = $visit->getColumn("visitIp"); + $outString .= "ignore"; + } + } + + public function getJavaScriptFiles(&$files) + { + $files[] = "plugins/QuickExcludeVisitorIP/javascripts/main.js"; + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..4929d16 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Matomo QuickExcludeVisitorIP Plugin + +## Description + + 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,<5.0.0-b1" + }, + "authors": [ + { + "name": "Lukas Winkler", + "email": "lukas@matomo.org", + "homepage": "https://lw1.at" + } + ], + "support": { + "email": "lukas@matomo.org", + "issues": "https://github.com/Findus23/plugin-QuickExcludeVisitorIP/issues", + "forum": "https://forum.matomo.org", + "source": "https://github.com/Findus23/plugin-QuickExcludeVisitorIP" + }, + "homepage": "https://lw1.at", + "license": "GPL v3+", + "keywords": [ + "IP", + "ignore" + ] +} diff --git a/screenshots/.gitkeep b/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29