Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benakamoorthi@fastmail.fm>2014-01-11 02:48:50 +0400
committerdiosmosis <benakamoorthi@fastmail.fm>2014-01-11 02:54:13 +0400
commitfb5454b703d00d50fb90fb7ddd0aa58656728093 (patch)
treefc5626edf1701b9c35baa1c5965a5dc5487067ba /plugins/AnonymizeIP
parent15853da8b03f0ab7a858a2335e9dbd62b7db4116 (diff)
Fixes #4493, move DoNotTrack & AnonymizeIP logic to PrivacyManager plugin. Includes modification to EventDipatcher to allow generic callbacks in getListHooksRegistered method.
Diffstat (limited to 'plugins/AnonymizeIP')
-rw-r--r--plugins/AnonymizeIP/AnonymizeIP.php88
1 files changed, 0 insertions, 88 deletions
diff --git a/plugins/AnonymizeIP/AnonymizeIP.php b/plugins/AnonymizeIP/AnonymizeIP.php
deleted file mode 100644
index 8348c931cc..0000000000
--- a/plugins/AnonymizeIP/AnonymizeIP.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- *
- * @category Piwik_Plugins
- * @package AnonymizeIP
- */
-namespace Piwik\Plugins\AnonymizeIP;
-
-use Piwik\Config;
-use Piwik\IP;
-use Piwik\Piwik;
-use Piwik\Version;
-
-/**
- * Anonymize visitor IP addresses to comply with the privacy laws/guidelines in countries, such as Germany.
- *
- * @package AnonymizeIP
- */
-class AnonymizeIP extends \Piwik\Plugin
-{
- /**
- * @see Piwik_Plugin::getInformation
- */
- public function getInformation()
- {
- return array(
- 'description' => Piwik::translate('AnonymizeIP_PluginDescription'),
- 'author' => 'Piwik',
- 'author_homepage' => 'http://piwik.org/',
- 'version' => Version::VERSION,
- 'license' => 'GPL v3+',
- 'license_homepage' => 'http://www.gnu.org/licenses/gpl.html'
- );
- }
-
- /**
- * @see Piwik_Plugin::getListHooksRegistered
- */
- public function getListHooksRegistered()
- {
- return array(
- 'Tracker.setVisitorIp' => 'setVisitorIpAddress',
- );
- }
-
- /**
- * Internal function to mask portions of the visitor IP address
- *
- * @param string $ip IP address in network address format
- * @param int $maskLength Number of octets to reset
- * @return string
- */
- public static function applyIPMask($ip, $maskLength)
- {
- // IPv4 or mapped IPv4 in IPv6
- if (IP::isIPv4($ip)) {
- $i = strlen($ip);
- if ($maskLength > $i) {
- $maskLength = $i;
- }
-
- while ($maskLength-- > 0) {
- $ip[--$i] = chr(0);
- }
- } else {
- $masks = array(
- 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
- 'ffff:ffff:ffff:ffff::',
- 'ffff:ffff:ffff:0000::',
- 'ffff:ff00:0000:0000::'
- );
- return $ip & pack('a16', inet_pton($masks[$maskLength]));
- }
- return $ip;
- }
-
- /**
- * Hook on Tracker.Visit.setVisitorIp to anomymize visitor IP addresses
- */
- public function setVisitorIpAddress(&$ip)
- {
- $ip = self::applyIPMask($ip, Config::getInstance()->Tracker['ip_address_mask_length']);
- }
-}