protected function writeCookie(array $preferences)
    {
        $data     = implode(',', $preferences);
        $lifetime = time() + self::$preferenceLifetime;
        $path     = '/';
        $server   = explode('.', $_SERVER['SERVER_NAME']);
        $domain   = '';

        for ($i = 2; $i > 0; --$i) {
            $domain = '.'.$server[$i].$domain;
        }

        // Store preferences in cookie and return result
        return setcookie(self::$identifier, $data, $lifetime, $path, $domain);
    }
protected function writeCookie(array $preferences)
    {
        $data     = implode(',', $preferences);
        $lifetime = time() + self::$preferenceLifetime;
        $path     = '/';
        $server   = explode('.', $_SERVER['SERVER_NAME']);
        $domain   = '';

        for ($i = 2; $i > 0; --$i) {
            $domain = '.'.$server[$i].$domain;
        }

        // Store preferences in cookie and return result
        return setcookie(self::$identifier, $data, $lifetime, $path, $domain);
    }
protected function writeCookie ( array $ preferences ) { $ data = implode ( ',' , $ preferences ) ; $ lifetime = time ( ) + self :: $ preferenceLifetime ; $ path = '/' ; $ server = explode ( '.' , $ _SERVER [ 'SERVER_NAME' ] ) ; $ domain = '' ; for ( $ i = 2 ; $ i > 0 ; -- $ i ) { $ domain = '.' . $ server [ $ i ] . $ domain ; } // Store preferences in cookie and return result return setcookie ( self :: $ identifier , $ data , $ lifetime , $ path , $ domain ) ; }
This method is intend to write preferences to a cookie on user's client.

@param array $preferences The preferences to store in session

@author Benjamin Carl <opensource@clickalicious.de>

@return bool TRUE on success, otherwise FALSE
This method is intend to write preferences to a cookie on user s client .