private function start() { if (self::$started) { return; } self::$started = true; $this->dispatcher = midgardmvc_core::get_instance()->dispatcher; try { if (!$this->dispatcher->headers_sent()) { $this->dispatcher->session_start(); } } catch (Exception $e) { midgardmvc_core::get_instance()->log(__CLASS__, "Couldn't start session: " . $e->getMessage(), 'warning'); $this->enabled = false; return; } /* Cache disabling made conditional based on domain/key existence */ // Check for session data and load or initialize it, if necessary if ($this->dispatcher->session_has_var(self::ROOT)) { $this->data = $this->dispatcher->session_get_var(self::ROOT); } else { $this->data['midgardmvc_core_services_sessioning'] = array(); $this->data['midgardmvc_core_services_sessioning']['startup'] = array(); $this->dispatcher->session_set_var(self::ROOT, $this->data); } }
/** * Removes the value associated with the specified key. Returns null if the key * is non-existent or the value of the key just removed otherwise. Note, that * this is not necessarily a valid non-existence check, as the sessioning * system does allow null values. Use the exists function if unsure. * * @param mixed $key The key to remove. * @return mixed The session key's data value, or NULL on failure. * @see midgardmvc_core_services_sessioning::exists() */ public function remove($key) { return $this->sessioning->remove($this->domain, $key); }