mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
issue 2473, load parent module when extended module file is not exists.
git-svn-id: http://xe-core.googlecode.com/svn/branches/luminous@11267 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cce6e6a948
commit
8dbb0b2a37
1 changed files with 32 additions and 20 deletions
|
|
@ -710,6 +710,7 @@
|
|||
|
||||
if(__DEBUG__==3) $start_time = getMicroTime();
|
||||
|
||||
$parent_module = $module;
|
||||
$kind = strtolower($kind);
|
||||
$type = strtolower($type);
|
||||
|
||||
|
|
@ -726,10 +727,13 @@
|
|||
// if there is no instance of the module in global variable, create a new one
|
||||
if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
|
||||
{
|
||||
$parent_module = $module;
|
||||
self::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
|
||||
|
||||
$class_path = ModuleHandler::getModulePath($module);
|
||||
if(!is_dir(FileHandler::getRealPath($class_path))) return NULL;
|
||||
if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
|
||||
{
|
||||
$module = $parent_module;
|
||||
self::_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)) {
|
||||
|
|
@ -738,23 +742,6 @@
|
|||
require_once($high_class_file);
|
||||
}
|
||||
|
||||
// Get the object's name
|
||||
$types = explode(' ', 'view controller model api wap mobile class');
|
||||
if(!in_array($type, $types)) $type = $types[0];
|
||||
if($type == 'class') {
|
||||
$instance_name = '%s';
|
||||
$class_file = '%s%s.%s.php';
|
||||
} elseif($kind == 'admin' && array_search($type, $types) < 3) {
|
||||
$instance_name = '%sAdmin%s';
|
||||
$class_file = '%s%s.admin.%s.php';
|
||||
} else{
|
||||
$instance_name = '%s%s';
|
||||
$class_file = '%s%s.%s.php';
|
||||
}
|
||||
$instance_name = sprintf($instance_name, $module, ucfirst($type));
|
||||
$class_file = sprintf($class_file, $class_path, $module, $type);
|
||||
$class_file = FileHandler::getRealPath($class_file);
|
||||
|
||||
// Get the name of the class file
|
||||
if(!is_readable($class_file)) return NULL;
|
||||
|
||||
|
|
@ -791,6 +778,31 @@
|
|||
return $GLOBALS['_loaded_module'][$module][$type][$kind];
|
||||
}
|
||||
|
||||
function _getModuleFilePath($module, $type, $kind, &$classPath, &$highClassFile, &$classFile, &$instanceName)
|
||||
{
|
||||
$classPath = ModuleHandler::getModulePath($module);
|
||||
|
||||
$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_,$classPath, $module);
|
||||
$highClassFile = FileHandler::getRealPath($highClassFile);
|
||||
|
||||
$types = explode(' ', 'view controller model api wap mobile class');
|
||||
if(!in_array($type, $types)) $type = $types[0];
|
||||
if($type == 'class') {
|
||||
$instanceName = '%s';
|
||||
$classFile = '%s%s.%s.php';
|
||||
} elseif($kind == 'admin' && array_search($type, $types) < 3) {
|
||||
$instanceName = '%sAdmin%s';
|
||||
$classFile = '%s%s.admin.%s.php';
|
||||
} else{
|
||||
$instanceName = '%s%s';
|
||||
$classFile = '%s%s.%s.php';
|
||||
}
|
||||
|
||||
$instanceName = sprintf($instanceName, $module, ucfirst($type));
|
||||
$classFile = sprintf($classFile, $classPath, $module, $type);
|
||||
$classFile = FileHandler::getRealPath($classFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* call a trigger
|
||||
* @param string $trigger_name trigger's name to call
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue