From 92b133b11dc6c662e2b95d71e3aaf7ee1802190b Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Wed, 2 Jan 2019 18:36:01 +0100 Subject: [PATCH] fix Froxlor::listFunction() api-call after namespacing Signed-off-by: Michael Kaufmann --- lib/Froxlor/Api/Commands/Froxlor.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Froxlor/Api/Commands/Froxlor.php b/lib/Froxlor/Api/Commands/Froxlor.php index 150441fa..e4701b89 100644 --- a/lib/Froxlor/Api/Commands/Froxlor.php +++ b/lib/Froxlor/Api/Commands/Froxlor.php @@ -247,10 +247,10 @@ class Froxlor extends \Froxlor\Api\ApiCommand // check existence $this->requireModules($module); // now get all static functions - $reflection = new \ReflectionClass($module); + $reflection = new \ReflectionClass(__NAMESPACE__ . '\\' . $module); $_functions = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($_functions as $func) { - if ($func->class == $module && $func->isPublic()) { + if ($func->class == __NAMESPACE__ . '\\' . $module && $func->isPublic()) { array_push($functions, array_merge(array( 'module' => $module, 'function' => $func->name @@ -279,10 +279,10 @@ class Froxlor extends \Froxlor\Api\ApiCommand continue; } // now get all static functions - $reflection = new \ReflectionClass($mod); + $reflection = new \ReflectionClass(__NAMESPACE__ . '\\' . $mod); $_functions = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($_functions as $func) { - if ($func->class == $mod && $func->isPublic() && ! $func->isStatic()) { + if ($func->class == __NAMESPACE__ . '\\' . $mod && $func->isPublic() && ! $func->isStatic()) { array_push($functions, array_merge(array( 'module' => $matches[1], 'function' => $func->name @@ -414,7 +414,7 @@ class Froxlor extends \Froxlor\Api\ApiCommand // check all the modules foreach ($modules as $module) { try { - $module = "\Froxlor\Api\Commands\\" . $module; + $module = __NAMESPACE__ . '\\' . $module; // can we use the class? if (class_exists($module)) { continue;