function _retrieveCurrentValue() { $this->current_value = PHP_VERSION; $url = 'http://php.net/releases/?serialize=1&version=5'; $timeout = Piwik_UpdateCheck::SOCKET_TIMEOUT; try { $latestVersion = Piwik::sendHttpRequest($url, $timeout); $versionInfo = Piwik_Common::unserialize_array($latestVersion); $this->recommended_value = $versionInfo['version']; } catch (Exception $e) { $this->recommended_value = ''; } }
/** * Load the cookie content into a php array. * Parses the cookie string to extract the different variables. * Unserialize the array when necessary. * Decode the non numeric values that were base64 encoded. */ protected function loadContentFromCookie() { $cookieStr = $_COOKIE[$this->name]; $values = explode( self::VALUE_SEPARATOR, $cookieStr); foreach($values as $nameValue) { $equalPos = strpos($nameValue, '='); $varName = substr($nameValue,0,$equalPos); $varValue = substr($nameValue,$equalPos+1); // no numeric value are base64 encoded so we need to decode them if(!is_numeric($varValue)) { $varValue = base64_decode($varValue); // some of the values may be serialized array so we try to unserialize it $varValue = Piwik_Common::unserialize_array($varValue); } $this->set($varName, $varValue); } }