diff options
author | Oliver Schramm <oliver.schramm97@gmail.com> | 2015-05-28 15:45:47 +0200 |
---|---|---|
committer | Oliver Schramm <oliver.schramm97@gmail.com> | 2015-08-05 17:45:14 +0200 |
commit | 2b30e632b6e266ef64d075ac0897972a8bb43bf1 (patch) | |
tree | 74697c0965ae318fb74d4e974b0e9582248342b6 /phpBB/phpbb/language | |
parent | 452c8bef28b363d50869421cf3346c23a25b6148 (diff) | |
download | forums-2b30e632b6e266ef64d075ac0897972a8bb43bf1.tar forums-2b30e632b6e266ef64d075ac0897972a8bb43bf1.tar.gz forums-2b30e632b6e266ef64d075ac0897972a8bb43bf1.tar.bz2 forums-2b30e632b6e266ef64d075ac0897972a8bb43bf1.tar.xz forums-2b30e632b6e266ef64d075ac0897972a8bb43bf1.zip |
[ticket/12143] Add is_set method to language service
We need that.
PHPBB3-12143
Diffstat (limited to 'phpBB/phpbb/language')
-rw-r--r-- | phpBB/phpbb/language/language.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php index 44131e3da3..3ffb466c19 100644 --- a/phpBB/phpbb/language/language.php +++ b/phpBB/phpbb/language/language.php @@ -194,6 +194,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 * * Function to mimic sprintf() with the possibility of using phpBB's language system to substitute nullar/singular/plural forms. |