/** * getBrowser * * @param string $user_agent the user agent string * @param bool $return_array whether return an array or an object * * @return \stdClass|array the object containing the browsers details. Array if * $return_array is set to true. */ public static function getBrowser($user_agent = null, $return_array = false) { $cachePath = self::CACHE_PATH; $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['jh_browscap']); if (preg_match('/^typo3temp\\//', $extConf['cachePath'])) { $cachePath = rtrim($extConf['cachePath'], '/'); } if (!is_dir(PATH_site . $cachePath)) { GeneralUtility::mkdir_deep(PATH_site, $cachePath); } /** @var Browscap $browscap */ $browscap = new Browscap($cachePath); $browscap->doAutoUpdate = false; return $browscap->getBrowser($user_agent, $return_array); }