mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Merge pull request #1374 from kijin/feature/autoload
classes 폴더 내의 주요 클래스에 autoload 적용
This commit is contained in:
commit
58f094a5f7
5 changed files with 118 additions and 105 deletions
|
|
@ -1044,31 +1044,18 @@ class ModuleHandler extends Handler
|
|||
ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
|
||||
}
|
||||
|
||||
// Get base class name and load the file contains it
|
||||
if(!class_exists($module, false))
|
||||
// Check if the base class and instance class exist
|
||||
if(!class_exists($module, true))
|
||||
{
|
||||
$high_class_file = sprintf('%s%s%s.class.php', _XE_PATH_, $class_path, $module);
|
||||
if(!file_exists($high_class_file))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
require_once($high_class_file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get the name of the class file
|
||||
if(!is_readable($class_file))
|
||||
if(!class_exists($instance_name, true))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create an instance with eval function
|
||||
require_once($class_file);
|
||||
if(!class_exists($instance_name, false))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
$tmp_fn = create_function('', "return new {$instance_name}();");
|
||||
$oModule = $tmp_fn();
|
||||
// Create an instance
|
||||
$oModule = new $instance_name();
|
||||
if(!is_object($oModule))
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue