6
6
* @author Miroslav Marek <mirek.marek@web-jet.cz>
7
7
*/
8
8
9
- namespace JetStudio ;
10
-
11
9
use Jet \Autoloader_Loader ;
12
10
use Jet \SysConf_Jet_Modules ;
11
+ use Jet \Application_Modules ;
13
12
14
13
/**
15
14
*
21
20
*/
22
21
public function getAutoloaderName () : string
23
22
{
24
- return 'application/Modules ' ;
23
+ return 'JetStudio/ application/Modules ' ;
25
24
}
26
25
/**
27
26
*
28
- * @param string $root_namespace
29
- * @param string $namespace
30
27
* @param string $class_name
31
28
*
32
29
* @return bool|string
33
30
*/
34
- public function getScriptPath ( string $ root_namespace , string $ namespace , string $ class_name ): bool |string
31
+ public function getScriptPath ( string $ class_name ): bool |string
35
32
{
36
- if ( $ root_namespace != SysConf_Jet_Modules::getModuleRootNamespace () ) {
33
+ $ modules_namespace = SysConf_Jet_Modules::getModuleRootNamespace ().'\\' ;
34
+
35
+ if (!str_starts_with ($ class_name , $ modules_namespace )) {
37
36
return false ;
38
37
}
39
-
40
- $ namespace = substr ( $ namespace , strlen ( $ root_namespace ) + 1 );
41
-
42
- $ module_path = ProjectConf_Path::getApplicationModules () . $ namespace . '/ ' ;
43
-
44
- $ module_path = str_replace ( '\\' , '/ ' , $ module_path );
45
- $ class_name = str_replace ( '_ ' , '/ ' , $ class_name );
46
-
47
- return $ module_path . $ class_name . '.php ' ;
38
+
39
+ $ module_and_class_name = substr ( $ class_name , strlen ($ modules_namespace ) );
40
+
41
+ $ module_name_end = strrpos ( $ module_and_class_name , '\\' );
42
+
43
+ $ module_name = substr ( $ module_and_class_name , 0 , $ module_name_end );
44
+ $ class_name = substr ( $ module_and_class_name , $ module_name_end +1 );
45
+
46
+ $ module_name = str_replace ( '\\' , '. ' , $ module_name );
47
+
48
+
49
+ return Application_Modules::getModuleDir ( $ module_name ) . $ this ->classNameToPath ( $ class_name );
48
50
}
49
51
};
0 commit comments