107         $this->_blIsTranslated = $blIsTranslated;
 
  127         $this->_iBaseLanguageId = null;
 
  137         if ($this->_iBaseLanguageId === null) {
 
  143             if ($blAdmin && (($iSeLang = 
oxRegistry::getConfig()->getRequestParameter(
'changelang')) !== null)) {
 
  144                 $this->_iBaseLanguageId = $iSeLang;
 
  147             if (is_null($this->_iBaseLanguageId)) {
 
  152             $aLanguageUrls = 
$myConfig->getConfigParam(
'aLanguageURLs');
 
  154             if (!$blAdmin && is_array($aLanguageUrls)) {
 
  155                 foreach ($aLanguageUrls as $iId => $sUrl) {
 
  156                     if ($sUrl && 
$myConfig->isCurrentUrl($sUrl)) {
 
  157                         $this->_iBaseLanguageId = $iId;
 
  163             if (is_null($this->_iBaseLanguageId)) {
 
  165                 if (!isset($this->_iBaseLanguageId)) {
 
  172             if (is_null($this->_iBaseLanguageId) && !$blAdmin && !
oxRegistry::getUtils()->isSearchEngine()) {
 
  175                 $this->_iBaseLanguageId = 
oxRegistry::get(
"oxUtilsServer")->getOxCookie(
'language');
 
  178                 if (is_null($this->_iBaseLanguageId)) {
 
  183             if (is_null($this->_iBaseLanguageId)) {
 
  184                 $this->_iBaseLanguageId = 
$myConfig->getConfigParam(
'sDefaultLang');
 
  187             $this->_iBaseLanguageId = (int) $this->_iBaseLanguageId;
 
  192             oxRegistry::get(
"oxUtilsServer")->setOxCookie(
'language', $this->_iBaseLanguageId);
 
  205         if ($this->_iObjectTplLanguageId === null) {
 
  208             if (!isset(
$aLanguages[$this->_iObjectTplLanguageId]) ||
 
  209                 $aLanguages[$this->_iObjectTplLanguageId]->active == 0
 
  227         if ($this->_iTplLanguageId === null) {
 
  242         if ($this->_iEditLanguageId === null) {
 
  251                 if (
"saveinnlang" == $this->
getConfig()->getActiveView()->getFncName()) {
 
  278     public function getLanguageArray($iLanguage = null, $blOnlyActive = 
false, $blSort = 
false)
 
  282         if (is_null($iLanguage)) {
 
  287         $aConfLanguages = 
$myConfig->getConfigParam(
'aLanguages');
 
  288         $aLangParams = 
$myConfig->getConfigParam(
'aLanguageParams');
 
  290         if (is_array($aConfLanguages)) {
 
  292             reset($aConfLanguages);
 
  293             while (list($key, $val) = each($aConfLanguages)) {
 
  295                 if ($blOnlyActive && is_array($aLangParams)) {
 
  297                     if (!$aLangParams[$key][
'active']) {
 
  304                     $oLang = 
new stdClass();
 
  305                     $oLang->id = isset($aLangParams[$key][
'baseId']) ? $aLangParams[$key][
'baseId'] : $i;
 
  310                     if (is_array($aLangParams)) {
 
  311                         $oLang->active = $aLangParams[$key][
'active'];
 
  312                         $oLang->sort = $aLangParams[$key][
'sort'];
 
  315                     $oLang->selected = (isset($iLanguage) && $oLang->id == $iLanguage) ? 1 : 0;
 
  322         if ($blSort && is_array($aLangParams)) {
 
  323             uasort(
$aLanguages, array($this, 
'_sortLanguagesCallback'));
 
  336         if ($this->_aAdminTplLanguageArray === null) {
 
  340             $this->_aAdminTplLanguageArray = array();
 
  342             $sSourceDir = 
$myConfig->getAppDir() . 
'views/admin/';
 
  343             foreach ($aLangArray as $iLangKey => $oLang) {
 
  344                 $sFilePath = 
"{$sSourceDir}{$oLang->abbr}/lang.php";
 
  345                 if (file_exists($sFilePath) && is_readable($sFilePath)) {
 
  346                     $this->_aAdminTplLanguageArray[$iLangKey] = $oLang;
 
  352         reset($this->_aAdminTplLanguageArray);
 
  366         if ($this->_aLangAbbr === null) {
 
  370         $iLanguage = isset($iLanguage) ? (int) $iLanguage : $this->
getBaseLanguage();
 
  371         if (isset($this->_aLangAbbr[$iLanguage])) {
 
  372             $iLanguage = $this->_aLangAbbr[$iLanguage];
 
  386         $aConfLanguages = $this->
getConfig()->getConfigParam(
'aLanguages');
 
  389         foreach ($aLangIds as $iId => $sValue) {
 
  406     public function translateString($sStringToTranslate, $iLang = null, $blAdminMode = null)
 
  411         if (isset(
$aLang[$sStringToTranslate])) {
 
  412             return $aLang[$sStringToTranslate];
 
  417         if (isset(
$aLang[$aMap[$sStringToTranslate]])) {
 
  418             return $aLang[$aMap[$sStringToTranslate]];
 
  422         if (count($this->_aAdditionalLangFiles)) {
 
  424             if (isset(
$aLang[$sStringToTranslate])) {
 
  425                 return $aLang[$sStringToTranslate];
 
  431         return $sStringToTranslate;
 
  446         foreach ($aData as $sValKey => $sValue) {
 
  447             if (strpos($sValKey, $sKey) === 0) {
 
  448                 $aCollection[$sValKey] = $sValue;
 
  467         startProfile(
"getSimilarByKey");
 
  470         $blAdmin = isset($blAdmin) ? $blAdmin : $this->
isAdmin();
 
  481         if (count($this->_aAdditionalLangFiles)) {
 
  486         stopProfile(
"getSimilarByKey");
 
  488         return $aSimilarConst;
 
  502             $oActCur = $this->
getConfig()->getActShopCurrencyObject();
 
  506         return number_format((
double) $sValue, $oActCur->decimal, $oActCur->dec, $oActCur->thousand);
 
  520         $sValue = ( string ) $dValue;
 
  523         if (($iDotPos = $oStr->strpos($sValue, 
'.')) !== 
false) {
 
  524             $iDecPos = $oStr->strlen($oStr->substr($sValue, $iDotPos + 1));
 
  527         $oActCur = $oActCur ? $oActCur : $this->
getConfig()->getActShopCurrencyObject();
 
  528         $iDecPos = ($iDecPos < $oActCur->decimal) ? $iDecPos : $oActCur->decimal;
 
  530         return number_format((
double) $dValue, $iDecPos, $oActCur->dec, $oActCur->thousand);
 
  542         if (!isset($iLanguage)) {
 
  546         $iLanguage = (int) $iLanguage;
 
  548         return (($iLanguage) ? 
"_$iLanguage" : 
"");
 
  560         $iLang = (int) $iLang;
 
  566             if (isset($oLang->id)) {
 
  581         if (is_null($iLang)) {
 
  584             $this->_iBaseLanguageId = (int) $iLang;
 
  587         if (defined(
'OXID_PHP_UNIT')) {
 
  588             modSession::getInstance();
 
  603         $this->_iTplLanguageId = isset($iLang) ? (int) $iLang : $this->
getBaseLanguage();
 
  611         if (defined(
'OXID_PHP_UNIT')) {
 
  612             modSession::getInstance();
 
  633         if ($sCharset == $newEncoding) {
 
  638         foreach ($aLangArray as $sKey => $sValue) {
 
  640             if ($blRecodeKeys === 
true) {
 
  641                 $sItemKey = iconv($sCharset, $newEncoding, $sItemKey);
 
  644             $aLangs[$sItemKey] = iconv($sCharset, $newEncoding, $sValue);
 
  645             unset($aLangArray[$sKey]);
 
  660         $newEncoding = 
'ISO-8859-15';
 
  661         if ($shopConfig->isUtf()) {
 
  662             $newEncoding = 
'UTF-8';
 
  678         $aLangFiles = array();
 
  680         $sAppDir = $oConfig->getAppDir();
 
  682         $sTheme = $oConfig->getConfigParam(
"sTheme");
 
  683         $sCustomTheme = $oConfig->getConfigParam(
"sCustomTheme");
 
  684         $sShopId = $oConfig->getShopId();
 
  688         $sGenericPath = $sAppDir . 
'translations/' . $sLang;
 
  690             $aLangFiles[] = $sGenericPath . 
"/lang.php";
 
  696             $sThemePath = $sAppDir . 
'views/' . $sTheme . 
'/' . $sLang;
 
  697             $aLangFiles[] = $sThemePath . 
"/lang.php";
 
  703             $sCustPath = $sAppDir . 
'views/' . $sCustomTheme . 
'/' . $sLang;
 
  704             $aLangFiles[] = $sCustPath . 
"/lang.php";
 
  717         return count($aLangFiles) ? $aLangFiles : 
false;
 
  730         $aLangFiles = array();
 
  732         $sAppDir = $oConfig->getAppDir();
 
  735         $aModulePaths = array();
 
  740         $sAdminPath = $sAppDir . 
'views/admin/' . $sLang;
 
  741         $aLangFiles[] = $sAdminPath . 
"/lang.php";
 
  742         $aLangFiles[] = $sAppDir . 
'translations/' . $sLang . 
'/translit_lang.php';
 
  746         $sThemePath = $sAppDir . 
'views/*/' . $sLang;
 
  747         $aLangFiles = $this->
_appendLangFile($aLangFiles, $sThemePath, 
"options");
 
  755         return count($aLangFiles) ? $aLangFiles : 
false;
 
  769         $aFiles = glob($sFullPath . 
"/*_{$sFilePattern}.php");
 
  770         if (is_array($aFiles) && count($aFiles)) {
 
  771             foreach ($aFiles as $sFile) {
 
  772                 if (!strpos($sFile, 
'cust_lang.php')) {
 
  773                     $aLangFiles[] = $sFile;
 
  793         $sAppDir = $oConfig->getAppDir();
 
  794         $sTheme = $oConfig->getConfigParam(
"sTheme");
 
  795         $sCustomTheme = $oConfig->getConfigParam(
"sCustomTheme");
 
  798             $aLangFiles[] = $sAppDir . 
'views/admin/' . $sLang . 
'/cust_lang.php';
 
  801                 $aLangFiles[] = $sAppDir . 
'views/' . $sTheme . 
'/' . $sLang . 
'/cust_lang.php';
 
  804                 $aLangFiles[] = $sAppDir . 
'views/' . $sCustomTheme . 
'/' . $sLang . 
'/cust_lang.php';
 
  823         if (is_array($aModulePaths)) {
 
  825             foreach ($aModulePaths as $sPath) {
 
  826                 $sFullPath = $oConfig->getModulesDir() . $sPath;
 
  827                 if (file_exists($sFullPath . 
'/application/')) {
 
  828                     $sFullPath .= 
'/application';
 
  830                 $sFullPath .= ($blForAdmin) ? 
'/views/admin/' : 
'/translations/';
 
  831                 $sFullPath .= $sLang;
 
  835                     $aLangFiles[] = $sFullPath . 
'/module_options.php';
 
  855         $sLangFilesIdent = 
'_default';
 
  856         if (is_array($aLangFiles) && $aLangFiles) {
 
  857             $sLangFilesIdent = 
'_' . md5(implode(
'+', $aLangFiles));
 
  860         return "langcache_" . ((int) $blAdmin) . 
"_{$iLang}_" . 
$myConfig->getShopId() . 
"_" . 
$myConfig->getConfigParam(
'sTheme') . $sLangFilesIdent;
 
  878         $aLangCache = $myUtils->getLangCache($sCacheName);
 
  879         if (!$aLangCache && $aLangFiles === null) {
 
  886         if (!$aLangCache && $aLangFiles) {
 
  887             $aLangCache = array();
 
  889             $aLangSeoReplaceChars = array();
 
  890             foreach ($aLangFiles as $sLangFile) {
 
  892                 if (file_exists($sLangFile) && is_readable($sLangFile)) {
 
  897                     if (isset(
$aLang[
'charset'])) {
 
  909                         $aLangCache = array_merge($aLangCache, 
$aLang);
 
  917             $aLangCache[
'_aSeoReplaceChars'] = $aLangSeoReplaceChars;
 
  920             $myUtils->setLangCache($sCacheName, $aLangCache);
 
  936         $blAdmin = isset($blAdmin) ? $blAdmin : $this->
isAdmin();
 
  937         $sKey = $iLang . ((int) $blAdmin);
 
  938         if (!isset($this->_aLangMap[$sKey])) {
 
  939             $this->_aLangMap[$sKey] = array();
 
  943             $sParentMapFile = 
$myConfig->getAppDir() . 
'/views/' . ($blAdmin ? 
'admin' : 
$myConfig->getConfigParam(
"sTheme")) . 
'/' . 
oxRegistry::getLang()->getLanguageAbbr($iLang) . 
'/map.php';
 
  944             $sCustomThemeMapFile = 
$myConfig->getAppDir() . 
'/views/' . ($blAdmin ? 
'admin' : 
$myConfig->getConfigParam(
"sCustomTheme")) . 
'/' . 
oxRegistry::getLang()->getLanguageAbbr($iLang) . 
'/map.php';
 
  946             if (file_exists($sCustomThemeMapFile) && is_readable($sCustomThemeMapFile)) {
 
  947                 $sMapFile = $sCustomThemeMapFile;
 
  948             } elseif (file_exists($sParentMapFile) && is_readable($sParentMapFile)) {
 
  949                 $sMapFile = $sParentMapFile;
 
  954                 $this->_aLangMap[$sKey] = $aMap;
 
  959         return $this->_aLangMap[$sKey];
 
  972         $iLang = ($iLang === null && $blAdmin) ? $this->
getTplLanguage() : $iLang;
 
  973         if (!isset($iLang)) {
 
  975             if (!isset($iLang)) {
 
  994         startProfile(
"_getLangTranslationArray");
 
  996         $blAdmin = isset($blAdmin) ? $blAdmin : $this->
isAdmin();
 
 1000         if (!isset($this->_aLangCache[$sCacheName])) {
 
 1001             $this->_aLangCache[$sCacheName] = array();
 
 1003         if (!isset($this->_aLangCache[$sCacheName][$iLang])) {
 
 1005             $this->_aLangCache[$sCacheName][$iLang] = $this->
_getLanguageFileData($blAdmin, $iLang, $aLangFiles);
 
 1008         stopProfile(
"_getLangTranslationArray");
 
 1011         return (isset($this->_aLangCache[$sCacheName][$iLang]) ? $this->_aLangCache[$sCacheName][$iLang] : array());
 
 1024         return ($a1->sort > $a2->sort);
 
 1046             $sLang = 
"<input type=\"hidden\" name=\"" . $this->
getName() . 
"\" value=\"" . $this->
getBaseLanguage() . 
"\" />";
 
 1064             $sLang = $this->
getName() . 
"=" . $iLang;
 
 1092             if (!$oStr->preg_match(
'/(\?|&(amp;)?)lang=[0-9]+/', $sUrl) &&
 
 1093                 ($iLang != $iDefaultLang || $iDefaultLang != $iBrowserLanguage)
 
 1096                     if ($oStr->strpos($sUrl, 
'?') === 
false) {
 
 1098                     } elseif (!$oStr->preg_match(
'/(\?|&(amp;)?)$/', $sUrl)) {
 
 1102                 $sUrl .= $sParam . 
"&";
 
 1104                 $sUrl = $oStr->preg_replace(
'/(\?|&(amp;)?)lang=[0-9]+/', 
'\1' . $sParam, $sUrl);
 
 1121         if (!is_null($sBrowserLanguage)) {
 
 1125                 if ($oLang->abbr == $sBrowserLanguage) {
 
 1139         $aTables = array(
"oxarticles", 
"oxartextends", 
"oxattribute",
 
 1140                          "oxcategories", 
"oxcontents", 
"oxcountry",
 
 1141                          "oxdelivery", 
"oxdiscount", 
"oxgroups", 
"oxlinks",
 
 1145                          "oxobject2attribute",
 
 1146                          "oxpayments", 
"oxselectlist", 
"oxshops",
 
 1147                          "oxactions", 
"oxwrapping", 
"oxdeliveryset",
 
 1148                          "oxvendor", 
"oxmanufacturers", 
"oxmediaurls",
 
 1152         $aMultiLangTables = $this->
getConfig()->getConfigParam(
'aMultiLangTables');
 
 1154         if (is_array($aMultiLangTables)) {
 
 1155             $aTables = array_merge($aTables, $aMultiLangTables);
 
 1186         if ($this->_aActiveModuleInfo === null) {
 
 1187             $oModuleList = 
oxNew(
'oxModuleList');
 
 1188             $this->_aActiveModuleInfo = $oModuleList->getActiveModuleInfo();
 
 1201         if ($this->_aDisabledModuleInfo === null) {
 
 1202             $oModuleList = 
oxNew(
'oxModuleList');
 
 1203             $this->_aDisabledModuleInfo = $oModuleList->getDisabledModuleInfo();
 
 1216         $sBrowserLang = null;
 
 1217         if (isset($_SERVER[
'HTTP_ACCEPT_LANGUAGE']) && $_SERVER[
'HTTP_ACCEPT_LANGUAGE']) {
 
 1218             $sBrowserLang = strtolower(substr($_SERVER[
'HTTP_ACCEPT_LANGUAGE'], 0, 2));
 
 1221         return $sBrowserLang;
 
 1245         if (empty($iShopId) || $iShopId == $this->
getConfig()->getShopId()) {
 
 1264         $aLangParams = $oConfig->getConfigParam(
'aLanguageParams');
 
 1265         if (is_array($aLangParams)) {
 
 1299         $aConfigDecodedValues = array();
 
 1302         foreach ($aConfigValues as $sConfigValue) {
 
 1303             $aConfigLanguages = unserialize($sConfigValue[
'oxvarvalue']);
 
 1306             if ($sLanguageParameterName == 
'aLanguageParams') {
 
 1308             } elseif ($sLanguageParameterName == 
'aLanguages') {
 
 1312             $aConfigDecodedValues = array_unique(array_merge($aConfigDecodedValues, 
$aLanguages));
 
 1315         return $aConfigDecodedValues;
 
 1332             select " . $oConfig->getDecodeValueQuery() . 
" as oxvarvalue 
 1334             where oxvarname = '{$sParamName}' ";
 
 1336         if (!empty($sShopId)) {
 
 1337             $sQuery .= 
" and oxshopid = '{$sShopId}' limit 1";
 
 1340         return $oDb->getArray($sQuery);
 
 1354         foreach ($aLanguageParams as $sAbbr => $aValue) {
 
 1355             $iBaseId = (int) $aValue[
'baseId'];