uawdijnntqw1x1x1
IP : 18.218.232.140
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
b24.axolotl.ru
/
.
/
public_html
/
bitrix
/
modules
/
rest
/
lib
/
lang.php
/
/
<?php namespace Bitrix\Rest; use Bitrix\Main\Localization\Loc; use Bitrix\Main; class Lang { private const DEFAULT_LANG = 'en'; private static $languageList; private const KEY_LANG_ALL = 'LANG_ALL'; /** * Return list of languages * @return array * @throws Main\LoaderException */ public static function listLanguage(): array { if (static::$languageList === null) { static::$languageList = [ LANGUAGE_ID, Loc::getDefaultLang(LANGUAGE_ID), ]; $licenseLang = null; if (Main\Loader::includeModule('bitrix24')) { $licenseLang = \CBitrix24::getLicensePrefix(); } else { $dbSites = \CSite::getList( 'sort', 'asc', [ 'DEFAULT' => 'Y', 'ACTIVE' => 'Y' ] ); if ($site = $dbSites->fetch() && !empty($site['LANGUAGE_ID'])) { $licenseLang = $site['LANGUAGE_ID']; } } if($licenseLang === null) { $licenseLang = static::DEFAULT_LANG; } static::$languageList[] = $licenseLang; } return static::$languageList; } public static function mergeFromLangAll($data) { $result = []; if (!empty($data[static::KEY_LANG_ALL])) { $useLang = false; $langList = static::listLanguage(); foreach ($langList as $lang) { if (is_array($data[static::KEY_LANG_ALL][$lang])) { $useLang = $lang; break; } } if ($useLang !== false) { $result = $data[static::KEY_LANG_ALL][$useLang]; } else { $item = reset($data[static::KEY_LANG_ALL]); if (is_array($item)) { $result = $item; } } } return array_merge($data, $result); } /** * @param array $param * @param string[] $fieldList * @param array $defaultValues * * @return array * @throws Main\LoaderException */ public static function fillCompatibility(array $param, array $fieldList, array $defaultValues = []) : array { $result = []; $langList = static::listLanguage(); $langDefault = reset($langList); if (empty($param[static::KEY_LANG_ALL])) { foreach ($fieldList as $key) { $value = trim($param[$key] ?? ''); if ($value !== '') { $result[static::KEY_LANG_ALL][$langDefault][$key] = $value; $result[$key] = trim($param[$key]); } elseif ($defaultValues[$key]) { $result[static::KEY_LANG_ALL][$langDefault][$key] = $defaultValues[$key]; $result[$key] = $defaultValues[$key]; } } } else { foreach ($param[static::KEY_LANG_ALL] as $langCode => $langItem) { foreach ($fieldList as $field) { $value = trim($langItem[$field] ?? ''); if ($value !== '') { $result[static::KEY_LANG_ALL][$langCode][$field] = $value; } elseif ($defaultValues[$field]) { $result[static::KEY_LANG_ALL][$langDefault][$field] = $defaultValues[$field]; } } } $result = static::mergeFromLangAll($result); } if (empty($result[static::KEY_LANG_ALL]) && !empty($defaultValues)) { $result[static::KEY_LANG_ALL][$langDefault] = $defaultValues; } return $result; } }
/var/www/axolotl/data/www/b24.axolotl.ru/./public_html/bitrix/modules/rest/lib/lang.php