Skip to content
Snippets Groups Projects
Commit c74c356f authored by Andjelko Horvat's avatar Andjelko Horvat
Browse files

SimpleSAML_XHTML_Template: add language parameter options (issue #530).

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3217 44740490-163a-0410-bde0-09ae8108e29a
parent 50b17783
No related branches found
No related tags found
No related merge requests found
......@@ -277,6 +277,12 @@ $config = array (
'language.rtl' => array('ar','dv','fa','ur','he'),
'language.default' => 'en',
/*
* Options to override the default settings for the language parameter
*/
'language.parameter.name' => 'language',
'language.parameter.setcookie' => TRUE,
/*
* Options to override the default settings for the language cookie
*/
......
......@@ -38,6 +38,12 @@ class SimpleSAML_XHTML_Template {
private $defaultDictionary = NULL;
/**
* HTTP GET language parameter name.
*/
private $languageParameterName = 'language';
/**
* Constructor
*
......@@ -52,9 +58,10 @@ class SimpleSAML_XHTML_Template {
$this->data['baseurlpath'] = $this->configuration->getBaseURL();
$this->availableLanguages = $this->configuration->getArray('language.available', array('en'));
if (isset($_GET['language'])) {
$this->setLanguage($_GET['language']);
$this->languageParameterName = $this->configuration->getString('language.parameter.name', 'language');
if (isset($_GET[$this->languageParameterName])) {
$this->setLanguage($_GET[$this->languageParameterName], $this->configuration->getBoolean('language.parameter.setcookie', TRUE));
}
if($defaultDictionary !== NULL && substr($defaultDictionary, -4) === '.php') {
......
......@@ -193,7 +193,7 @@ if($onLoad !== '') {
if ($current) {
$textarray[] = $langnames[$lang];
} else {
$textarray[] = '<a href="' . htmlspecialchars(SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), array('language' => $lang))) . '">' .
$textarray[] = '<a href="' . htmlspecialchars(SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), array($this->languageParameterName => $lang))) . '">' .
$langnames[$lang] . '</a>';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment