/**
  * Loads the config, connects to the session and gets any flash
  * data from the previous request
  *
  * @return  void
  */
 protected static function initialize()
 {
     Flash::$config = Kohana::config('flash');
     // Get a reference to the session data array
     $session_data =& Session::instance(Flash::$config['session_group'])->as_array();
     // Bind the flash session to the flash array within the session data
     Flash::$session =& $session_data[Flash::$config['session_key']];
     // Copy existing flash data into the data array
     Flash::$data = is_array(Flash::$session) ? Flash::$session : array();
     // Clear any old flash data
     Flash::$session = array();
 }
Пример #2
0
 /**
  * @return Flash
  */
 public static function get()
 {
     $key = Flash::config()->session_name;
     $data = Session::get($key);
     Session::clear($key);
     return new Flash($data);
 }