/** * Returns the string to save in the cookie from the $this->value array of values. * It goes through the array and generates the cookie content string. * * @return string Cookie content */ protected function generateContentString() { $cookieStr = ''; foreach ($this->value as $name => $value) { if (!is_numeric($value)) { // @see http://bugs.php.net/38680 if (PHP_VERSION < '5.2.1') { $value = base64_encode(safe_serialize($value)); } else { $value = base64_encode(json_encode($value)); } } $cookieStr .= "{$name}={$value}" . self::VALUE_SEPARATOR; } if (!empty($cookieStr)) { $cookieStr .= '_='; // sign cookie $signature = sha1($cookieStr . Core_Common::getSalt()); return $cookieStr . $signature; } return ''; }