112         $this->_iBaseLanguageId = null;
 
  122         if ( $this->_iBaseLanguageId === null ) {
 
  129                 $this->_iBaseLanguageId = $iSeLang;
 
  132             if ( is_null( $this->_iBaseLanguageId ) ) {
 
  137             $aLanguageUrls = 
$myConfig->getConfigParam( 
'aLanguageURLs' );
 
  139             if ( !$blAdmin && is_array( $aLanguageUrls ) ) {
 
  140                 foreach ( $aLanguageUrls as $iId => $sUrl ) {
 
  141                     if ( $sUrl && 
$myConfig->isCurrentUrl( $sUrl ) ) {
 
  142                         $this->_iBaseLanguageId = $iId;
 
  148             if ( is_null( $this->_iBaseLanguageId ) ) {
 
  150                 if (!isset($this->_iBaseLanguageId)) {
 
  157             if ( is_null( $this->_iBaseLanguageId ) && !$blAdmin && !
oxRegistry::getUtils()->isSearchEngine() ) {
 
  160                 $this->_iBaseLanguageId = 
oxRegistry::get(
"oxUtilsServer")->getOxCookie( 
'language' );
 
  163                 if ( is_null( $this->_iBaseLanguageId ) ) {
 
  168             if ( is_null( $this->_iBaseLanguageId ) ) {
 
  169                 $this->_iBaseLanguageId = 
$myConfig->getConfigParam( 
'sDefaultLang' );
 
  172             $this->_iBaseLanguageId = (int) $this->_iBaseLanguageId;
 
  175             $this->_iBaseLanguageId = $this->
validateLanguage( $this->_iBaseLanguageId );
 
  177             oxRegistry::get(
"oxUtilsServer")->setOxCookie( 
'language', $this->_iBaseLanguageId );
 
  190         if ( $this->_iObjectTplLanguageId === null ) {
 
  193             if ( !isset( 
$aLanguages[$this->_iObjectTplLanguageId] ) ||
 
  194                  $aLanguages[$this->_iObjectTplLanguageId]->active == 0 ) {
 
  198         return $this->_iObjectTplLanguageId;
 
  210         if ( $this->_iTplLanguageId === null ) {
 
  224         if ( $this->_iEditLanguageId === null ) {
 
  233                 if ( 
"saveinnlang" == $this->
getConfig()->getActiveView()->getFncName() ) {
 
  259     public function getLanguageArray( $iLanguage = null, $blOnlyActive = 
false, $blSort = 
false )
 
  263         if ( is_null($iLanguage) ) {
 
  268         $aConfLanguages = 
$myConfig->getConfigParam( 
'aLanguages' );
 
  269         $aLangParams    = 
$myConfig->getConfigParam( 
'aLanguageParams' );
 
  271         if ( is_array( $aConfLanguages ) ) {
 
  273             reset( $aConfLanguages );
 
  274             while ( list( $key, $val ) = each( $aConfLanguages ) ) {
 
  276                 if ( $blOnlyActive && is_array($aLangParams) ) {
 
  278                     if ( !$aLangParams[$key][
'active'] ) {
 
  285                     $oLang = 
new stdClass();
 
  286                     $oLang->id   = isset($aLangParams[$key][
'baseId']) ? $aLangParams[$key][
'baseId'] : $i;
 
  291                     if ( is_array( $aLangParams ) ) {
 
  292                         $oLang->active = $aLangParams[$key][
'active'];
 
  293                         $oLang->sort   = $aLangParams[$key][
'sort'];
 
  296                     $oLang->selected = ( isset( $iLanguage ) && $oLang->id == $iLanguage ) ? 1 : 0;
 
  303         if ( $blSort && is_array($aLangParams) ) {
 
  304             uasort( 
$aLanguages, array($this, 
'_sortLanguagesCallback') );
 
  316         if ( $this->_aAdminTplLanguageArray === null ) {
 
  320             $this->_aAdminTplLanguageArray = array();
 
  322             $sSourceDir = 
$myConfig->getAppDir() . 
'views/admin/';
 
  323             foreach ( $aLangArray as $iLangKey => $oLang ) {
 
  324                 $sFilePath = 
"{$sSourceDir}{$oLang->abbr}/lang.php";
 
  325                 if ( file_exists( $sFilePath ) && is_readable( $sFilePath ) ) {
 
  326                     $this->_aAdminTplLanguageArray[$iLangKey] = $oLang;
 
  332         reset( $this->_aAdminTplLanguageArray );
 
  345         if ( $this->_aLangAbbr === null ) {
 
  349         $iLanguage = isset( $iLanguage ) ? (int) $iLanguage : $this->
getBaseLanguage();
 
  350         if ( isset( $this->_aLangAbbr[$iLanguage] ) ) {
 
  351             $iLanguage = $this->_aLangAbbr[$iLanguage];
 
  365         $aConfLanguages = $this->
getConfig()->getConfigParam( 
'aLanguages' );
 
  368         foreach ( $aLangIds as $iId => $sValue ) {
 
  386     public function translateString( $sStringToTranslate, $iLang = null, $blAdminMode = null )
 
  390         if ( isset( 
$aLang[$sStringToTranslate] ) ) {
 
  391             return $aLang[$sStringToTranslate];
 
  396         if ( isset( 
$aLang[$aMap[$sStringToTranslate]] ) ) {
 
  397             return $aLang[$aMap[$sStringToTranslate]];
 
  401         if (count($this->_aAdditionalLangFiles)) {
 
  403             if (isset( 
$aLang[$sStringToTranslate] )) {
 
  404                 return $aLang[$sStringToTranslate];
 
  408         return $sStringToTranslate;
 
  423         foreach ( $aData as $sValKey => $sValue ) {
 
  424             if ( strpos( $sValKey, $sKey ) === 0 ) {
 
  425                 $aCollection[$sValKey] = $sValue;
 
  444         startProfile(
"getSimilarByKey");
 
  447         $blAdmin = isset( $blAdmin ) ? $blAdmin : $this->
isAdmin();
 
  455         $aSimilarConst = $this->
_collectSimilar( $aMap, $sKey, $aSimilarConst );
 
  458         if ( count( $this->_aAdditionalLangFiles ) ) {
 
  463         stopProfile(
"getSimilarByKey");
 
  465         return $aSimilarConst;
 
  479             $oActCur = $this->
getConfig()->getActShopCurrencyObject();
 
  482         return number_format( (
double)$sValue, $oActCur->decimal, $oActCur->dec, $oActCur->thousand );
 
  496         $sValue  = ( string ) $dValue;
 
  498         if ( ( $iDotPos = $oStr->strpos( $sValue, 
'.' ) ) !== 
false ) {
 
  499             $iDecPos = $oStr->strlen( $oStr->substr( $sValue, $iDotPos + 1 ) );
 
  502         $oActCur = $oActCur ? $oActCur : $this->
getConfig()->getActShopCurrencyObject();
 
  503         $iDecPos = ( $iDecPos < $oActCur->decimal ) ? $iDecPos : $oActCur->decimal;
 
  504         return number_format( (
double)$dValue, $iDecPos, $oActCur->dec, $oActCur->thousand );
 
  516         if ( !isset( $iLanguage ) ) {
 
  520         $iLanguage = (int) $iLanguage;
 
  522         return ( ( $iLanguage )?
"_$iLanguage":
"" );
 
  534         $iLang = (int) $iLang;
 
  540             if (isset($oLang->id)) {
 
  557         if ( is_null($iLang) ) {
 
  560             $this->_iBaseLanguageId = (int) $iLang;
 
  563         if ( defined( 
'OXID_PHP_UNIT' ) ) {
 
  579         $this->_iTplLanguageId = isset( $iLang ) ? (int) $iLang : $this->
getBaseLanguage();
 
  582             if ( !isset( 
$aLanguages[$this->_iTplLanguageId] ) ) {
 
  587         if ( defined( 
'OXID_PHP_UNIT' ) ) {
 
  607         foreach ( $aLangArray as $sKey => $sValue ) {
 
  609             if ($blRecodeKeys === 
true) {
 
  610                 $sItemKey = iconv($sCharset, 
'UTF-8', $sItemKey);
 
  613             $aLangs[$sItemKey] = iconv( $sCharset, 
'UTF-8', $sValue );
 
  614             unset($aLangArray[$sKey]);
 
  630         $aLangFiles = array();
 
  632         $sAppDir        = $oConfig->getAppDir();
 
  634         $sTheme         = $oConfig->getConfigParam( 
"sTheme" );
 
  635         $sCustomTheme   = $oConfig->getConfigParam( 
"sCustomTheme" );
 
  636         $sShopId        = $oConfig->getShopId();
 
  640         $sGenericPath = $sAppDir . 
'translations/' . $sLang;
 
  641         if ( $sGenericPath ) {
 
  642             $aLangFiles[] = $sGenericPath . 
"/lang.php";
 
  648             $sThemePath = $sAppDir . 
'views/' . $sTheme .
'/' . $sLang;
 
  649             $aLangFiles[] = $sThemePath . 
"/lang.php";
 
  654         if ( $sCustomTheme ) {
 
  655             $sCustPath = $sAppDir . 
'views/' . $sCustomTheme .
'/' . $sLang;
 
  656             $aLangFiles[] = $sCustPath . 
"/lang.php";
 
  669         return count( $aLangFiles ) ? $aLangFiles : 
false;
 
  682         $aLangFiles = array();
 
  684         $sAppDir        = $oConfig->getAppDir();
 
  687         $aModulePaths = array();
 
  692         $sAdminPath = $sAppDir . 
'views/admin/' . $sLang;
 
  693         $aLangFiles[] = $sAdminPath . 
"/lang.php";
 
  694         $aLangFiles[] = $sAppDir . 
'translations/' . $sLang . 
'/translit_lang.php';
 
  698         $sThemePath = $sAppDir . 
'views/*/' . $sLang;
 
  699         $aLangFiles = $this->
_appendLangFile( $aLangFiles, $sThemePath, 
"options" );
 
  707         return count( $aLangFiles ) ? $aLangFiles : 
false;
 
  721         $aFiles = glob( $sFullPath . 
"/*_{$sFilePattern}.php" );
 
  722         if ( is_array( $aFiles ) && count( $aFiles ) ) {
 
  723             foreach ( $aFiles as $sFile ) {
 
  724                 if ( !strpos( $sFile, 
'cust_lang.php' ) ) {
 
  725                     $aLangFiles[] = $sFile;
 
  744         $sAppDir      = $oConfig->getAppDir();
 
  745         $sTheme       = $oConfig->getConfigParam( 
"sTheme" );
 
  746         $sCustomTheme = $oConfig->getConfigParam( 
"sCustomTheme" );
 
  749             $aLangFiles[] = $sAppDir . 
'views/admin/' . $sLang . 
'/cust_lang.php';
 
  752                 $aLangFiles[] = $sAppDir . 
'views/' . $sTheme . 
'/' . $sLang . 
'/cust_lang.php';
 
  754             if ( $sCustomTheme ) {
 
  755                 $aLangFiles[] = $sAppDir . 
'views/' . $sCustomTheme . 
'/' . $sLang . 
'/cust_lang.php';
 
  774         if ( is_array( $aModulePaths ) ) {
 
  778             foreach ( $aModulePaths as $sPath ) {
 
  779                 $sFullPath  = $oConfig->getModulesDir() . $sPath;
 
  780                 $sFullPath .= ($blForAdmin) ? 
'/views/admin/' : 
'/translations/';
 
  781                 $sFullPath .= $sLang;
 
  783                 if ( !is_dir( $sFullPath ) ) {
 
  784                     $sFullPath = $oConfig->getModulesDir() . $sPath;
 
  785                     $sFullPath .= ($blForAdmin) ? 
'/out/admin/' : 
'/out/lang/';
 
  786                     $sFullPath .= $sLang;
 
  792                     $aLangFiles[] = $sFullPath . 
'/module_options.php';
 
  812         $sLangFilesIdent = 
'_default';
 
  813         if (is_array($aLangFiles) && $aLangFiles) {
 
  814             $sLangFilesIdent = 
'_'.md5(implode(
'+', $aLangFiles));
 
  816         return "langcache_" . ( (int) $blAdmin ) . 
"_{$iLang}_" . 
$myConfig->getShopId() . 
"_" . 
$myConfig->getConfigParam( 
'sTheme' ).$sLangFilesIdent;
 
  834         $aLangCache = $myUtils->getLangCache( $sCacheName );
 
  835         if ( !$aLangCache && $aLangFiles === null ) {
 
  842         if ( !$aLangCache && $aLangFiles ) {
 
  843             $aLangCache = array();
 
  844             $sBaseCharset = 
false;
 
  846             $aLangSeoReplaceChars = array();
 
  847             foreach ( $aLangFiles as $sLangFile ) {
 
  849                 if ( file_exists( $sLangFile ) && is_readable( $sLangFile ) ) {
 
  854                     if ( isset( 
$aLang[
'charset'] ) ) {
 
  865                             $aLang[
'charset'] = 
'UTF-8';
 
  872                         if ( !$sBaseCharset ) {
 
  873                             $sBaseCharset = 
$aLang[
'charset'];
 
  876                         $aLangCache = array_merge( $aLangCache, 
$aLang );
 
  882             if ( $sBaseCharset ) {
 
  883                 $aLangCache[
'charset'] = $sBaseCharset;
 
  887             $aLangCache[
'_aSeoReplaceChars'] = $aLangSeoReplaceChars;
 
  890             $myUtils->setLangCache( $sCacheName, $aLangCache );
 
  906         $blAdmin = isset( $blAdmin ) ? $blAdmin : $this->
isAdmin();
 
  907         $sKey = $iLang . ( (int) $blAdmin );
 
  908         if ( !isset( $this->_aLangMap[$sKey] ) ) {
 
  909             $this->_aLangMap[$sKey] = array();
 
  913             $sParentMapFile = 
$myConfig->getAppDir() . 
'/views/' .  ( $blAdmin ? 
'admin' : 
$myConfig->getConfigParam( 
"sTheme" ) ) .
'/' . 
oxRegistry::getLang()->getLanguageAbbr( $iLang ) . 
'/map.php';
 
  914             $sCustomThemeMapFile = 
$myConfig->getAppDir() . 
'/views/' .  ( $blAdmin ? 
'admin' : 
$myConfig->getConfigParam( 
"sCustomTheme" ) ) .
'/' . 
oxRegistry::getLang()->getLanguageAbbr( $iLang ) . 
'/map.php';
 
  916             if ( file_exists( $sCustomThemeMapFile ) && is_readable( $sCustomThemeMapFile ) ) {
 
  917                 $sMapFile = $sCustomThemeMapFile;
 
  918             } elseif ( file_exists( $sParentMapFile ) && is_readable( $sParentMapFile ) ) {
 
  919                 $sMapFile = $sParentMapFile;
 
  924                 $this->_aLangMap[$sKey] = $aMap;
 
  929         return $this->_aLangMap[$sKey];
 
  942         $iLang = ( $iLang === null && $blAdmin ) ? $this->
getTplLanguage() : $iLang;
 
  943         if ( !isset( $iLang ) ) {
 
  945             if ( !isset( $iLang ) ) {
 
  964         startProfile(
"_getLangTranslationArray");
 
  966         $blAdmin    = isset( $blAdmin ) ? $blAdmin : $this->
isAdmin();
 
  970         if ( !isset( $this->_aLangCache[$sCacheName] ) ) {
 
  971             $this->_aLangCache[$sCacheName] = array();
 
  973         if ( !isset( $this->_aLangCache[$sCacheName][$iLang] ) ) {
 
  975             $this->_aLangCache[$sCacheName][$iLang] = $this->
_getLanguageFileData( $blAdmin, $iLang, $aLangFiles );
 
  978         stopProfile(
"_getLangTranslationArray");
 
  981         return ( isset( $this->_aLangCache[$sCacheName][$iLang] ) ? $this->_aLangCache[$sCacheName][$iLang] : array() );
 
  994         return ($a1->sort > $a2->sort);
 
 1016             $sLang = 
"<input type=\"hidden\" name=\"".$this->getName().
"\" value=\"". $this->
getBaseLanguage() . 
"\" />";
 
 1033             $sLang = $this->
getName().
"=". $iLang;
 
 1057             if ( !$oStr->preg_match(
'/(\?|&(amp;)?)lang=[0-9]+/', $sUrl)  && ($iLang != 
oxRegistry::getConfig()->getConfigParam( 
'sDefaultLang' ))) {
 
 1059                     if ($oStr->strpos( $sUrl, 
'?') === 
false) {
 
 1061                     } elseif ( !$oStr->preg_match(
'/(\?|&(amp;)?)$/', $sUrl ) ) {
 
 1065                 $sUrl .= $sParam.
"&";
 
 1067                 $sUrl = 
getStr()->preg_replace(
'/(\?|&(amp;)?)lang=[0-9]+/', 
'\1'.$sParam, $sUrl);
 
 1082         $sBrowserLang = strtolower( substr( $_SERVER[
'HTTP_ACCEPT_LANGUAGE'], 0, 2 ) );
 
 1084         if ( !$sBrowserLang ) {
 
 1090         foreach ( $aLangs as $oLang ) {
 
 1091             if ( $oLang->abbr == $sBrowserLang ) {
 
 1092                 return (
int) $oLang->id;
 
 1104         $aTables = array( 
"oxarticles", 
"oxartextends", 
"oxattribute",
 
 1105                           "oxcategories", 
"oxcontents", 
"oxcountry",
 
 1106                           "oxdelivery", 
"oxdiscount", 
"oxgroups",
 
 1107                           "oxlinks", 
"oxnews", 
"oxobject2attribute",
 
 1108                           "oxpayments", 
"oxselectlist", 
"oxshops",
 
 1109                           "oxactions", 
"oxwrapping", 
"oxdeliveryset",
 
 1110                           "oxvendor", 
"oxmanufacturers", 
"oxmediaurls",
 
 1114         $aMultiLangTables = $this->
getConfig()->getConfigParam( 
'aMultiLangTables' );
 
 1116         if ( is_array( $aMultiLangTables ) ) {
 
 1117             $aTables = array_merge($aTables, $aMultiLangTables);
 
 1148         if ($this->_aActiveModuleInfo === null) {
 
 1149             $oModuleList = 
oxNew(
'oxModuleList');
 
 1150             $this->_aActiveModuleInfo = $oModuleList->getActiveModuleInfo();
 
 1162         if ($this->_aDisabledModuleInfo === null) {
 
 1163             $oModuleList = 
oxNew(
'oxModuleList');
 
 1164             $this->_aDisabledModuleInfo = $oModuleList->getDisabledModuleInfo();
 
 1190         if ( empty( $iShopId ) || $iShopId == $this->
getConfig()->getShopId() ) {
 
 1209         $aLangParams = $oConfig->getConfigParam( 
'aLanguageParams' );
 
 1210         if ( is_array( $aLangParams ) ) {
 
 1244         $aConfigDecodedValues = array();
 
 1247         foreach ( $aConfigValues as $sConfigValue )
 
 1249             $aConfigLanguages = unserialize( $sConfigValue[
'oxvarvalue'] );
 
 1252             if ( $sLanguageParameterName == 
'aLanguageParams' ) {
 
 1254             } elseif ( $sLanguageParameterName == 
'aLanguages' ) {
 
 1258             $aConfigDecodedValues = array_unique( array_merge( $aConfigDecodedValues, 
$aLanguages ) );
 
 1261         return $aConfigDecodedValues;
 
 1278             select ".$oConfig->getDecodeValueQuery().
" as oxvarvalue 
 1280             where oxvarname = '{$sParamName}' ";
 
 1282         if ( !empty( $sShopId ) ) {
 
 1283             $sQuery .= 
" and oxshopid = '{$sShopId}' limit 1";
 
 1286         return $oDb->getArray( $sQuery );
 
 1300         foreach ( $aLanguageParams as $sAbbr => $aValue ) {
 
 1301             $iBaseId = (int) $aValue[ 
'baseId' ];