/**
  * return a string representation of the given cookie array
  * @return string
  */
 public function getCookiesString()
 {
     $cookies = $this->_cookie->get();
     return implode(self::COOKIES_DELIMITER, array_map(function ($key, $value) {
         return "{$key}={$value}";
     }, array_keys($cookies), $cookies));
 }
示例#2
0
 /**
  * Set cookie
  * Override period if asked to
  *
  * @param string $name The cookie name
  * @param string $value The cookie value
  * @param int $period Lifetime period
  * @param string $path
  * @param string $domain
  * @param int|bool $secure
  * @return Mage_Core_Model_Cookie
  */
 public function set($name, $value, $period = null, $path = null, $domain = null, $secure = null, $httponly = null)
 {
     if (is_null($period)) {
         // use $_SESSION directly as session classes may not be initialised yet
         $session = isset($_SESSION['rememberme']) ? (bool) $_SESSION['rememberme'] : false;
         $login = Mage::app()->getRequest()->getPost('login');
         $rememberme = isset($login['rememberme']) ? (bool) $login['rememberme'] : false;
         $period = $session || $rememberme;
         // true = one year
     }
     return parent::set($name, $value, $period, $path, $domain, $secure, $httponly);
 }
示例#3
0
 /**
  * Get accepted save cookies websites
  *
  * @return array
  */
 protected function _getAcceptedSaveCookiesWebsites()
 {
     $serializedList = $this->_cookieModel->get(self::IS_USER_ALLOWED_SAVE_COOKIE);
     $unSerializedList = json_decode($serializedList, true);
     return is_array($unSerializedList) ? $unSerializedList : array();
 }