mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
#2025 좀더 근본적인 해결: 모듈 autoload시 lang파일 자동 로딩하도록 변경
This commit is contained in:
parent
4c261abfb8
commit
0fafb1cf6b
4 changed files with 21 additions and 15 deletions
|
|
@ -91,12 +91,6 @@ class ModuleObject extends BaseObject
|
|||
$obj->user = Rhymix\Framework\Session::getMemberInfo();
|
||||
}
|
||||
|
||||
// Load language files.
|
||||
if($module !== 'module')
|
||||
{
|
||||
Context::loadLang($module_path . 'lang');
|
||||
}
|
||||
|
||||
// Return the instance.
|
||||
return $GLOBALS['_module_instances_'][$class_name] = $obj;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,10 +93,15 @@ $GLOBALS['RX_AUTOLOAD_FILE_MAP'] = array_change_key_case(array(
|
|||
spl_autoload_register(function($class_name)
|
||||
{
|
||||
$filename = false;
|
||||
$langpath = false;
|
||||
$lc_class_name = str_replace('\\', '/', strtolower($class_name));
|
||||
if (preg_match('!^rhymix/(framework|addons|modules|plugins)/(.+)$!', $lc_class_name, $matches))
|
||||
{
|
||||
$filename = RX_BASEDIR . ($matches[1] === 'framework' ? 'common/framework' : $matches[1]) . '/' . $matches[2] . '.php';
|
||||
if ($matches[1] !== 'framework')
|
||||
{
|
||||
$langpath = RX_BASEDIR . $matches[1] . '/lang';
|
||||
}
|
||||
}
|
||||
elseif (isset($GLOBALS['RX_AUTOLOAD_FILE_MAP'][$lc_class_name]))
|
||||
{
|
||||
|
|
@ -104,14 +109,22 @@ spl_autoload_register(function($class_name)
|
|||
}
|
||||
elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Item|Api|Wap|Mobile)?$/', $class_name, $matches))
|
||||
{
|
||||
$filename = RX_BASEDIR . 'modules/' . strtolower($matches[1] . '/' . $matches[1]);
|
||||
if (isset($matches[2]) && $matches[2]) $filename .= '.admin';
|
||||
$filename .= (isset($matches[3]) && $matches[3]) ? ('.' . strtolower($matches[3])) : '.class';
|
||||
$filename .= '.php';
|
||||
$module = strtolower($matches[1]);
|
||||
$filename = RX_BASEDIR . 'modules/' . $module . '/' . $module .
|
||||
(!empty($matches[2]) ? '.admin' : '') .
|
||||
(!empty($matches[3]) ? ('.' . strtolower($matches[3])) : '.class') . '.php';
|
||||
if ($module !== 'module')
|
||||
{
|
||||
$langpath = RX_BASEDIR . 'modules/' . $module . '/lang';
|
||||
}
|
||||
}
|
||||
if ($filename && file_exists($filename))
|
||||
{
|
||||
include $filename;
|
||||
if ($langpath)
|
||||
{
|
||||
Context::loadLang($langpath);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -134,8 +134,7 @@ class memberModel extends member
|
|||
{
|
||||
if($value->isDefaultForm && empty($value->isCustomTitle))
|
||||
{
|
||||
$title = in_array($value->name, ['signature', 'profile_image', 'image_name', 'image_mark']) ? 'member.' . $value->name : $value->name;
|
||||
$config->signupForm[$key]->title = lang($title);
|
||||
$config->signupForm[$key]->title = lang($value->name);
|
||||
}
|
||||
$config->signupForm[$key]->isPublic = $config->signupForm[$key]->isPublic ?? 'Y';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<label class="x_control-label" for="limit_day">{$lang->limit_day}</label>
|
||||
<div class="x_controls">
|
||||
<input type="number" min="0" id="limit_day" name="limit_day" value="{$config->limit_day}" /> {$lang->unit_day}
|
||||
<input type="text" name="limit_day_description" value="{escape($config->limit_day_description)}" placeholder="{$lang->limit_day_description}" style="width:90%" class="lang_code" />
|
||||
<input type="text" name="limit_day_description" value="{$config->limit_day_description|autoescape}" placeholder="{$lang->limit_day_description}" style="width:90%" class="lang_code" />
|
||||
<p class="x_help-block">{$lang->about_limit_day}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -122,9 +122,9 @@
|
|||
<div class="wrap">
|
||||
<button type="button" class="dragBtn">Move to</button>
|
||||
<!--@if(in_array($item->name, ['birthday', 'signature', 'profile_image', 'image_name', 'image_mark']))-->
|
||||
<input class="_title_edit lang_code" type="text" name="{$item->name}_title_edit" value="{escape($item->title)}" placeholder="{lang($item->name)}" />
|
||||
<input class="_title_edit lang_code" type="text" name="{$item->name}_title_edit" value="{$item->title|autoescape}" placeholder="{lang($item->name)}" />
|
||||
<!--@else-->
|
||||
<span class="_title" style="display:inline-block;white-space:pre-line;overflow:inherit;width:120px;text-overflow:ellipsis" title="{$item->title}">{$item->title}</span>
|
||||
<span class="_title" style="display:inline-block;white-space:pre-line;overflow:inherit;width:120px;text-overflow:ellipsis" title="{$item->title|autoescape}">{$item->title}</span>
|
||||
<!--@endif-->
|
||||
</div>
|
||||
</th>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue