18
18
* @version $Id: plugin.php 12944 2015-01-23 13:05:09Z beckmi $
19
19
*/
20
20
21
- if (!defined ('XOOPS_ROOT_PATH ' )) {
22
- throw new Exception ('XOOPS root path not defined ' );
23
- }
21
+ defined ('XOOPS_ROOT_PATH ' ) || exit ('XOOPS root path not defined ' );
22
+
24
23
include_once dirname (__DIR__ ) . '/include/common.php ' ;
25
24
xoops_load ('XoopsLists ' );
26
25
include_once $ GLOBALS ['xoops ' ]->path ("modules/ {$ mymenus ->dirname }/class/registry.php " );
@@ -65,7 +64,7 @@ public static function &getInstance()
65
64
public function setPlugins ()
66
65
{
67
66
if (is_dir ($ dir = $ GLOBALS ['xoops ' ]->path ("modules/ {$ this ->mymenus ->dirname }/plugins/ " ))) {
68
- $ pluginsList = XoopsLists::getDirListAsArray ($ dir, '' );
67
+ $ pluginsList = XoopsLists::getDirListAsArray ($ dir );
69
68
foreach ($ pluginsList as $ plugin ) {
70
69
if (file_exists ($ GLOBALS ['xoops ' ]->path ("modules/ {$ this ->mymenus ->dirname }/plugins/ {$ plugin }/ {$ plugin }.php " ))) {
71
70
$ this ->plugins [] = $ plugin ;
@@ -77,7 +76,7 @@ public function setPlugins()
77
76
public function setEvents ()
78
77
{
79
78
foreach ($ this ->plugins as $ plugin ) {
80
- include_once $ GLOBALS ['xoops ' ]->path ("/ modules/ {$ this ->mymenus ->dirname }/plugins/ {$ plugin }/ {$ plugin }.php " );
79
+ include_once $ GLOBALS ['xoops ' ]->path ("modules/ {$ this ->mymenus ->dirname }/plugins/ {$ plugin }/ {$ plugin }.php " );
81
80
$ className = ucfirst ($ plugin ) . 'MymenusPluginItem ' ;
82
81
if (!class_exists ($ className )) {
83
82
continue ;
@@ -123,11 +122,14 @@ public function loadLanguage($name)
123
122
{
124
123
$ mymenus = MymenusMymenus::getInstance ();
125
124
$ language = $ GLOBALS ['xoopsConfig ' ]['language ' ];
126
- $ path = $ GLOBALS ['xoops ' ]->path ("modules/ {$ mymenus ->dirname }/plugins/ {$ name }/language " );
127
- if (!($ ret = @include_once "{$ path }/ {$ language }/ {$ name }.php " )) {
128
- $ ret = @include_once "{$ path }/english/ {$ name }.php " ;
129
- }
125
+ // $path = $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/plugins/{$name}/language");
126
+ // if (!($ret = @include_once "{$path}/{$language}/{$name}.php")) {
127
+ // $ret = @include_once "{$path}/english/{$name}.php";
128
+ // }
129
+ // return $ret;
130
130
131
- return $ ret ;
131
+ $ path2 = "{$ mymenus ->dirname }/plugins/ {$ name }/ {$ language }/ " ;
132
+ xoops_loadLanguage ($ name , $ path2 );
133
+ return true ;
132
134
}
133
135
}
0 commit comments