모듈 클래스 로딩에서 autoload를 사용할 수 있도록 함

This commit is contained in:
Kijin Sung 2015-04-06 21:18:39 +09:00
parent cc572122b2
commit d0753e746b
2 changed files with 14 additions and 19 deletions

View file

@ -332,6 +332,14 @@ if(!defined('__XE_LOADED_CLASS__'))
{
require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][$class_name];
}
elseif(preg_match('/^([a-z0-9_]+?)(admin)?(view|controller|model|api|wap|mobile)?$/i', $class_name, $matches))
{
$candidate_filename = 'modules/' . $matches[1] . '/' . $matches[1] . ($matches[2] ? '.admin' : '') . ($matches[3] ? ('.' . $matches[3]) : '.class') . '.php';
if(file_exists(_XE_PATH_ . $candidate_filename))
{
require _XE_PATH_ . $candidate_filename;
}
}
}
spl_autoload_register('__xe_autoload');