isAuthenticated()) { return false; } $value = Common::getRequestVar($urlParamToOverride, false, 'string', $request->getParams()); if (!empty($value)) { return $value; } return false; } public function getRequiredVisitFields() { return array('location_ip', 'location_browser_lang'); } protected function getLocationDetail($userInfo, $locationKey) { $useLocationCache = empty($GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING']); $location = $this->getVisitorGeolocator()->getLocation($userInfo, $useLocationCache); if (!isset($location[$locationKey])) { return false; } return $location[$locationKey]; } protected function getVisitorGeolocator() { if ($this->visitorGeolocator === null) { $this->visitorGeolocator = new VisitorGeolocator(); } return $this->visitorGeolocator; } protected function getUserInfo(Request $request, Visitor $visitor) { $ipAddress = $this->getIpAddress($visitor->getVisitorColumn('location_ip'), $request); $language = $request->getBrowserLanguage(); $userInfo = array('lang' => $language, 'ip' => $ipAddress); return $userInfo; } private function getIpAddress($anonymizedIp, \Piwik\Tracker\Request $request) { $privacyConfig = new PrivacyManagerConfig(); $ip = $request->getIp(); if ($privacyConfig->useAnonymizedIpForVisitEnrichment) { $ip = $anonymizedIp; } $ipAddress = IPUtils::binaryToStringIP($ip); return $ipAddress; } }