mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-25 05:14:56 +09:00
Clean up ModuleController::replaceDefinedLangCode()
This commit is contained in:
parent
2e6e097272
commit
f8859769e8
15 changed files with 64 additions and 77 deletions
|
|
@ -783,13 +783,10 @@ class moduleAdminController extends module
|
|||
$module = trim($val->module);
|
||||
if(!$module) continue;
|
||||
|
||||
// replace user defined lang.
|
||||
$oModuleController->replaceDefinedLangCode($val->browser_title);
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->module_srl = $val->module_srl;
|
||||
$obj->layout_srl = $val->layout_srl;
|
||||
$obj->browser_title = $val->browser_title;
|
||||
$obj->browser_title = Context::replaceUserLang($val->browser_title);
|
||||
$obj->mid = $val->mid;
|
||||
$obj->module_category_srl = $val->module_category_srl;
|
||||
if($val->module_category_srl > 0)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ class moduleAdminModel extends module
|
|||
*/
|
||||
function getModuleAdminModuleList()
|
||||
{
|
||||
$oModuleController = getController('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$args = new stdClass;
|
||||
$args->module_srls = Context::get('module_srls');
|
||||
|
|
@ -31,8 +30,12 @@ class moduleAdminModel extends module
|
|||
foreach($output->data as $key => $val)
|
||||
{
|
||||
$info_xml = $oModuleModel->getModuleInfoXml($val->module);
|
||||
$oModuleController->replaceDefinedLangCode($val->browser_title);
|
||||
$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
|
||||
$list[$val->module_srl] = array(
|
||||
'module_srl' => $val->module_srl,
|
||||
'mid' => $val->mid,
|
||||
'browser_title' => Context::replaceUserLang($val->browser_title),
|
||||
'module_name' => $info_xml->title,
|
||||
);
|
||||
}
|
||||
$modules = explode(',',$args->module_srls);
|
||||
$module_list = [];
|
||||
|
|
|
|||
|
|
@ -1080,35 +1080,14 @@ class moduleController extends module
|
|||
/**
|
||||
* @brief Change user-defined language
|
||||
*/
|
||||
function replaceDefinedLangCode(&$output, $isReplaceLangCode = true)
|
||||
public static function replaceDefinedLangCode(&$output, $replace = true)
|
||||
{
|
||||
static $lang = null;
|
||||
|
||||
if($isReplaceLangCode)
|
||||
if ($replace)
|
||||
{
|
||||
if($lang === null)
|
||||
{
|
||||
$lang = Rhymix\Framework\Cache::get('site_and_module:user_defined_langs:0:' . Context::getLangType());
|
||||
if($lang === null)
|
||||
{
|
||||
$oModuleAdminController = getAdminController('module');
|
||||
$lang = $oModuleAdminController->makeCacheDefinedLangCode(0);
|
||||
}
|
||||
}
|
||||
|
||||
$output = preg_replace_callback('/\$user_lang->([a-z0-9\_]+)/is', function($matches) use($lang) {
|
||||
if(isset($lang[$matches[1]]) && !Context::get($matches[1]))
|
||||
{
|
||||
return $lang[$matches[1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
return str_replace('$user_lang->', '', $matches[0]);
|
||||
}
|
||||
}, $output);
|
||||
$output = Context::replaceUserLang($output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Add and update a file into the file box
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -404,11 +404,6 @@ class moduleModel extends module
|
|||
$module_info = $mid_info;
|
||||
}
|
||||
|
||||
/*
|
||||
$oModuleController = getController('module');
|
||||
if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
|
||||
*/
|
||||
|
||||
self::_applyDefaultSkin($module_info);
|
||||
return self::addModuleExtraVars($module_info);
|
||||
}
|
||||
|
|
@ -2342,7 +2337,7 @@ class moduleModel extends module
|
|||
$langCode = Context::get('langCode');
|
||||
if (!$langCode) return;
|
||||
|
||||
ModuleController::getInstance()->replaceDefinedLangCode($langCode);
|
||||
$langCode = Context::replaceUserLang($langCode);
|
||||
$this->add('lang', $langCode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue