public function getConfigId(Request $request, $ipAddress) { list($plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie) = $request->getPlugins(); $userAgent = $request->getUserAgent(); $deviceDetector = DeviceDetectorFactory::getInstance($userAgent); $aBrowserInfo = $deviceDetector->getClient(); if ($aBrowserInfo['type'] != 'browser') { // for now only track browsers unset($aBrowserInfo); } $browserName = !empty($aBrowserInfo['short_name']) ? $aBrowserInfo['short_name'] : 'UNK'; $browserVersion = !empty($aBrowserInfo['version']) ? $aBrowserInfo['version'] : ''; if ($deviceDetector->isBot()) { $os = self::OS_BOT; } else { $os = $deviceDetector->getOS(); $os = empty($os['short_name']) ? 'UNK' : $os['short_name']; } $browserLang = substr($request->getBrowserLanguage(), 0, 20); // limit the length of this string to match db return $this->getConfigHash($request, $os, $browserName, $browserVersion, $plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie, $ipAddress, $browserLang); }
protected function loadInfo() { list($plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie) = $this->request->getPlugins(); $resolution = $this->request->getParam('res'); $userAgent = $this->request->getUserAgent(); $deviceDetector = DeviceDetectorFactory::getInstance($userAgent); $aBrowserInfo = $deviceDetector->getClient(); if ($aBrowserInfo['type'] != 'browser') { // for now only track browsers unset($aBrowserInfo); } $browserName = !empty($aBrowserInfo['short_name']) ? $aBrowserInfo['short_name'] : 'UNK'; $browserVersion = !empty($aBrowserInfo['version']) ? $aBrowserInfo['version'] : ''; if ($deviceDetector->isBot()) { $os = self::OS_BOT; } else { $os = $deviceDetector->getOS(); $os = empty($os['short_name']) ? 'UNK' : $os['short_name']; } $browserLang = substr($this->request->getBrowserLanguage(), 0, 20); // limit the length of this string to match db $configurationHash = $this->getConfigHash($os, $browserName, $browserVersion, $plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie, $this->ipAddress, $browserLang); $this->params = array('config_id' => $configurationHash, 'config_os' => $os, 'config_os_version' => $deviceDetector->getOs('version'), 'config_browser_name' => $browserName, 'config_browser_version' => $browserVersion, 'config_device_type' => $deviceDetector->getDevice(), 'config_device_model' => $deviceDetector->getModel(), 'config_device_brand' => $deviceDetector->getBrand(), 'config_resolution' => $resolution, 'config_pdf' => $plugin_PDF, 'config_flash' => $plugin_Flash, 'config_java' => $plugin_Java, 'config_director' => $plugin_Director, 'config_quicktime' => $plugin_Quicktime, 'config_realplayer' => $plugin_RealPlayer, 'config_windowsmedia' => $plugin_WindowsMedia, 'config_gears' => $plugin_Gears, 'config_silverlight' => $plugin_Silverlight, 'config_cookie' => $plugin_Cookie, 'location_browser_lang' => $browserLang); }
/** * Live/Bing/MSN bot and Googlebot are evolving to detect cloaked websites. * As a result, these sophisticated bots exhibit characteristics of * browsers (cookies enabled, executing JavaScript, etc). * * @see \DeviceDetector\Parser\Bot * * @return boolean */ protected function isNonHumanBot() { $allowBots = $this->request->getParam('bots'); $deviceDetector = DeviceDetectorFactory::getInstance($this->userAgent); return !$allowBots && ($deviceDetector->isBot() || $this->isIpInRange()); }
protected function getUAParser($userAgent) { return DeviceDetectorFactory::getInstance($userAgent); }