Adapted MessageLib, PhrasesLib and UDFLib to use the function getUserLanguage from language_helper

This commit is contained in:
Paolo
2018-07-05 12:13:02 +02:00
parent 83f262f170
commit d08eb75b5a
3 changed files with 10 additions and 27 deletions
+2 -15
View File
@@ -242,21 +242,8 @@ class PhrasesLib
$categories = array($categories);
}
// Use the given language if present, otherwise retrives the language for the logged user
$language = DEFAULT_LANGUAGE;
if (count($parameters) == 2 && !isEmptyString($parameters[1]) && is_string($parameters[1]))
{
$language = $parameters[1];
}
// Checks if the user is authenticated to retrive the users's language
// NOTE: this library could be called when the user is not logged in the system
// so this is why is checked if the function getAuthUID exists
elseif (function_exists('getAuthUID'))
{
$this->_ci->load->model('person/Person_model', 'PersonModel');
$language = $this->_ci->PersonModel->getLanguage(getAuthUID());
}
// Retrives the language of the logged user
$language = getUserLanguage(count($parameters) == 2 ? $parameters[1] : null);
// If only categories is not an empty array then loads phrases
if (count($categories) > 0) $this->_setPhrases($categories, $language);