Ejemplo n.º 1
0
 static function initialize()
 {
     self::$cookies = $_COOKIE;
     if (class_exists('session')) {
         // Grab the cookie jar and set cookies as needed
         self::$jar = (array) session::get('__cookiejar');
         // Add the cookies from the jar to the cookies collection so
         // we can access them.
         foreach (self::$jar as $cookie) {
             self::$cookies[$cookie[0]] = $cookie[1];
         }
         if (!headers_sent()) {
             foreach (self::$jar as $cookie) {
                 call_user_func_array('setcookie', $cookie);
                 session::clr('__cookiejar');
             }
             // Then empty the jar
             self::$jar = array();
             session::clr('__cookiejar');
         } else {
             throw new BaseException("Cookie jar for delayed cookies loaded but output already started");
         }
     }
 }