adding configuration option to set a default language and/or force it,

resolves #39
This commit is contained in:
El RIDO 2015-10-18 20:38:07 +02:00
parent ca07398b66
commit e3f4aa982c
4 changed files with 47 additions and 2 deletions

View file

@ -185,6 +185,16 @@ class zerobin
$this->_model = new model($this->_conf);
$this->_request = new request;
$this->_urlbase = array_key_exists('REQUEST_URI', $_SERVER) ? $_SERVER['REQUEST_URI'] : '/';
// set default language
$lang = $this->_conf->getKey('languagedefault');
i18n::setLanguageFallback($lang);
// force default language, if language selection is disabled and a default is set
if (!$this->_conf->getKey('languageselection') && strlen($lang) == 2)
{
$_COOKIE['lang'] = $lang;
setcookie('lang', $lang);
}
}
/**
@ -448,6 +458,13 @@ class zerobin
$page->draw($this->_conf->getKey('template'));
}
/**
* outputs requested JSON-LD context
*
* @access private
* @param string $type
* @return void
*/
private function _jsonld($type)
{
if (
@ -475,7 +492,7 @@ class zerobin
}
/**
* return JSON encoded message and exit
* prepares JSON encoded status message
*
* @access private
* @param bool $status