mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-01 05:55:02 +03:00
Отступы в коде
This commit is contained in:
parent
063d5b0c99
commit
6cb4bce844
|
@ -117,10 +117,10 @@ class ModuleLang extends Module {
|
|||
foreach ($aPluginList as $sPluginName) {
|
||||
$aFiles=glob($sDir.$sPluginName.'/templates/language/'.$sLangName.'.php');
|
||||
if($aFiles and count($aFiles)) {
|
||||
foreach ($aFiles as $sFile) {
|
||||
if (file_exists($sFile)) {
|
||||
$this->AddMessages(include($sFile), array('category' =>'plugin', 'name' =>$sPluginName));
|
||||
}
|
||||
foreach ($aFiles as $sFile) {
|
||||
if (file_exists($sFile)) {
|
||||
$this->AddMessages(include($sFile), array('category' =>'plugin', 'name' =>$sPluginName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,35 +186,35 @@ class ModuleLang extends Module {
|
|||
* @return string
|
||||
*/
|
||||
public function Get($sName,$aReplace=array()) {
|
||||
if (!Config::Get('lang.disable_blocks') && strpos($sName, '.')) {
|
||||
$sLang = &$this->aLangMsg;
|
||||
$aKeys = explode('.', $sName);
|
||||
foreach ($aKeys as $k) {
|
||||
if (isset($sLang[$k])) {
|
||||
$sLang = $sLang[$k];
|
||||
} else {
|
||||
return 'NOT_FOUND_LANG_TEXT';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isset($this->aLangMsg[$sName])) {
|
||||
$sLang=$this->aLangMsg[$sName];
|
||||
} else {
|
||||
return 'NOT_FOUND_LANG_TEXT';
|
||||
}
|
||||
}
|
||||
if (!Config::Get('lang.disable_blocks') && strpos($sName, '.')) {
|
||||
$sLang = &$this->aLangMsg;
|
||||
$aKeys = explode('.', $sName);
|
||||
foreach ($aKeys as $k) {
|
||||
if (isset($sLang[$k])) {
|
||||
$sLang = $sLang[$k];
|
||||
} else {
|
||||
return 'NOT_FOUND_LANG_TEXT';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isset($this->aLangMsg[$sName])) {
|
||||
$sLang=$this->aLangMsg[$sName];
|
||||
} else {
|
||||
return 'NOT_FOUND_LANG_TEXT';
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($aReplace)&&count($aReplace)&&is_string($sLang)) {
|
||||
foreach ($aReplace as $sFrom => $sTo) {
|
||||
$aReplacePairs["%%{$sFrom}%%"]=$sTo;
|
||||
}
|
||||
$sLang=strtr($sLang,$aReplacePairs);
|
||||
}
|
||||
if(is_array($aReplace)&&count($aReplace)&&is_string($sLang)) {
|
||||
foreach ($aReplace as $sFrom => $sTo) {
|
||||
$aReplacePairs["%%{$sFrom}%%"]=$sTo;
|
||||
}
|
||||
$sLang=strtr($sLang,$aReplacePairs);
|
||||
}
|
||||
|
||||
if(Config::Get('module.lang.delete_undefined') and is_string($sLang)) {
|
||||
$sLang=preg_replace("/\%\%[\S]+\%\%/U",'',$sLang);
|
||||
}
|
||||
return $sLang;
|
||||
if(Config::Get('module.lang.delete_undefined') and is_string($sLang)) {
|
||||
$sLang=preg_replace("/\%\%[\S]+\%\%/U",'',$sLang);
|
||||
}
|
||||
return $sLang;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,19 +224,19 @@ class ModuleLang extends Module {
|
|||
*/
|
||||
public function AddMessages($aMessages, $aBlock = null) {
|
||||
if (is_array($aMessages)) {
|
||||
if (!Config::Get('lang.disable_blocks') && is_array($aBlock)) {
|
||||
if (isset($aBlock['category'])) {
|
||||
if (!isset($this->aLangMsg[$aBlock['category']]) || !$this->aLangMsg[$aBlock['category']]) {$this->aLangMsg[$aBlock['category']] = array();}
|
||||
$this->aLangMsg[$aBlock['category']][$aBlock['name']] = $aMessages;
|
||||
} else {
|
||||
$this->aLangMsg [$aBlock['name']] = $aMessages;
|
||||
}
|
||||
}
|
||||
if (count($this->aLangMsg)==0) {
|
||||
$this->aLangMsg = $aMessages;
|
||||
} else {
|
||||
$this->aLangMsg = array_merge($this->aLangMsg, $aMessages);
|
||||
}
|
||||
if (!Config::Get('lang.disable_blocks') && is_array($aBlock)) {
|
||||
if (isset($aBlock['category'])) {
|
||||
if (!isset($this->aLangMsg[$aBlock['category']]) || !$this->aLangMsg[$aBlock['category']]) {$this->aLangMsg[$aBlock['category']] = array();}
|
||||
$this->aLangMsg[$aBlock['category']][$aBlock['name']] = $aMessages;
|
||||
} else {
|
||||
$this->aLangMsg [$aBlock['name']] = $aMessages;
|
||||
}
|
||||
}
|
||||
if (count($this->aLangMsg)==0) {
|
||||
$this->aLangMsg = $aMessages;
|
||||
} else {
|
||||
$this->aLangMsg = array_merge($this->aLangMsg, $aMessages);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue