public function logout() { Gregory::get()->doAction('auth.logout', array($this->getIdentity())); $this->auth->clearIdentity(); if (isset($this->identity->sessions)) { $this->identity->sessions->unsetAll(); } $this->identity = null; }
public static function template($layout, $data = array(), $clean = true) { if (strlen($layout) < 1024 && file_exists($layout)) { $layout = Gregory::get()->renderFile($layout, $data); } $html = $layout; if (isset($data) && is_array($data)) { foreach ($data as $key => $content) { if (is_array($content)) { } else { $html = str_replace('%{' . strtoupper($key) . '}', $content, $html); } } } if ($clean) { $html = preg_replace('/\\%\\{[^\\}]+\\}/', '', $html); } return $html; }