Skip to content

Commit

Permalink
Рефакторинг загрузки текстовок в шаблон
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhelskiy committed Feb 6, 2017
1 parent 9e97e2b commit a6222bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
23 changes: 10 additions & 13 deletions classes/modules/lang/Lang.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ protected function InitLang()
}

$this->LoadLangJs();
/**
* Загружаем в шаблон
*/
$this->Viewer_Assign('aLang', array(&$this->aLangMsg), false, true);
}

/**
Expand All @@ -125,15 +121,6 @@ protected function LoadLangJs()
}
}

/**
* Прогружает в шаблон текстовки в виде JS
*
*/
protected function AssignToJs()
{
$this->Viewer_Assign('aLangJs', $this->GetLangJs());
}

public function GetLangJs($bPrepare = true)
{
if ($bPrepare) {
Expand Down Expand Up @@ -275,6 +262,16 @@ public function GetLangMsg()
return $this->aLangMsg;
}

/**
* Получить список текстовок по ссылке
*
* @return array
*/
public function &GetLangMsgRef()
{
return $this->aLangMsg;
}

/**
* Получает текстовку по её имени
*
Expand Down
7 changes: 6 additions & 1 deletion classes/modules/viewer/Viewer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ public function GetLocalViewer()
$oViewerLocal = new $sClass(Engine::getInstance());
$oViewerLocal->Init(true);
$oViewerLocal->VarAssign();
$oViewerLocal->Assign('aLang', $this->Lang_GetLangMsg());
return $oViewerLocal;
}

Expand Down Expand Up @@ -285,6 +284,12 @@ public function VarAssign()
* Загружаем security-ключ
*/
$this->Assign("LIVESTREET_SECURITY_KEY", $this->Security_GetSecurityKey());
/**
* Текстовки
*/
$oModuleLang = Engine::getInstance()->GetModuleObject('Lang');
$aLang =& $oModuleLang->GetLangMsgRef();
$this->Assign('aLang', array(&$aLang), false, true);
}

/**
Expand Down

0 comments on commit a6222bf

Please sign in to comment.