diff options
Diffstat (limited to 'plugins/AnonymizeIP/AnonymizeIP.php')
-rw-r--r-- | plugins/AnonymizeIP/AnonymizeIP.php | 106 |
1 files changed, 52 insertions, 54 deletions
diff --git a/plugins/AnonymizeIP/AnonymizeIP.php b/plugins/AnonymizeIP/AnonymizeIP.php index ebb0c29180..e7b311fc26 100644 --- a/plugins/AnonymizeIP/AnonymizeIP.php +++ b/plugins/AnonymizeIP/AnonymizeIP.php @@ -16,63 +16,61 @@ */ class Piwik_AnonymizeIP extends Piwik_Plugin { - /** - * Get plugin information - * @return array - */ - public function getInformation() - { - return array( - 'description' => Piwik_Translate('AnonymizeIP_PluginDescription'), - 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, - 'TrackerPlugin' => true, - ); - } + /** + * Get plugin information + * @return array + */ + public function getInformation() + { + return array( + 'description' => Piwik_Translate('AnonymizeIP_PluginDescription'), + 'author' => 'Piwik', + 'author_homepage' => 'http://piwik.org/', + 'version' => Piwik_Version::VERSION, + 'TrackerPlugin' => true, + ); + } - /** - * Get list of hooks to register - * @return array - */ - public function getListHooksRegistered() - { - return array( - 'Tracker.Visit.setVisitorIp' => 'setVisitorIpAddress', - ); - } + /** + * Get list of hooks to register + * @return array + */ + public function getListHooksRegistered() + { + return array( + 'Tracker.Visit.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 - */ - static public function applyIPMask($ip, $maskLength) - { - $i = Piwik_Common::strlen($ip); - if($maskLength > $i) - { - $maskLength = $i; - } + /** + * 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 + */ + static public function applyIPMask($ip, $maskLength) + { + $i = Piwik_Common::strlen($ip); + if ($maskLength > $i) { + $maskLength = $i; + } - while($maskLength-- > 0) - { - $ip[--$i] = chr(0); - } + while ($maskLength-- > 0) { + $ip[--$i] = chr(0); + } - return $ip; - } + return $ip; + } - /** - * Hook on Tracker.Visit.setVisitorIp to anonymize visitor IP addresses - * - * @param Piwik_Event_Notification $notification notification object - */ - function setVisitorIpAddress($notification) - { - $ip =& $notification->getNotificationObject(); - $ip = self::applyIPMask($ip, Piwik_Config::getInstance()->Tracker['ip_address_mask_length']); - } + /** + * Hook on Tracker.Visit.setVisitorIp to anonymize visitor IP addresses + * + * @param Piwik_Event_Notification $notification notification object + */ + function setVisitorIpAddress($notification) + { + $ip =& $notification->getNotificationObject(); + $ip = self::applyIPMask($ip, Piwik_Config::getInstance()->Tracker['ip_address_mask_length']); + } } |