mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 15:45:34 +02:00
[ticket/12143] Add is_set method to language service
We need that. PHPBB3-12143
This commit is contained in:
parent
452c8bef28
commit
2b30e632b6
@ -193,6 +193,36 @@ class language
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key array|string The language key we want to know more about. Can be string or array.
|
||||
*
|
||||
* @return bool Returns whether the language key is set.
|
||||
*/
|
||||
public function is_set($key)
|
||||
{
|
||||
// Load common language files if they not loaded yet
|
||||
if (!$this->common_language_files_loaded)
|
||||
{
|
||||
$this->load_common_language_files();
|
||||
}
|
||||
|
||||
if (is_array($key))
|
||||
{
|
||||
$lang = &$this->lang[array_shift($key)];
|
||||
|
||||
foreach ($key as $_key)
|
||||
{
|
||||
$lang = &$lang[$_key];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang = &$this->lang[$key];
|
||||
}
|
||||
|
||||
return isset($lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Advanced language substitution
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user