public function add_template_vars()
{
// set the locale and character set that habari is configured to use presently
if (!isset($this->locale)) {
$this->locale = Options::get('locale', 'en');
// default to 'en' just in case we somehow don't have one?
}
if (!isset($this->charset)) {
$this->charset = MultiByte::hab_encoding();
}
if (!isset($this->user)) {
$this->user = User::identify();
}
if (!isset($this->loggedin)) {
$this->loggedin = User::identify()->loggedin;
}
if (!isset($this->page)) {
$this->page = isset($this->page) ? $this->page : 1;
}
if (!isset($this->page_title)) {
$this->page_title = $this->page_title();
// This calls theme_page_title via the theme_* plugin hook.
}
$handler = Controller::get_handler();
if (isset($handler)) {
Plugins::act('add_template_vars', $this, $handler->handler_vars);
}
$this->added_template_vars = true;
}