Fixing rest api dispatching for plugins with camelcase names

- plugin camelcase names are supported now
- fix for bug when a requests like
    GET /plugin-erik/hello/world
    GET /plugin-nonExistsPlugin/hello/world
  was resolving and dispatching the same resource
This commit is contained in:
erik
2015-04-29 16:15:57 -05:00
parent decbedd451
commit 467a241887
2 changed files with 3 additions and 3 deletions

View File

@@ -353,7 +353,7 @@ class WebApplication
$tmp = array_shift($tmp);
$tmp = explode('-', $tmp);
$pluginName = $tmp[1];
$uri = str_replace('/plugin-'.$pluginName, '', $uri);
$uri = str_replace('plugin-'.$pluginName, strtolower($pluginName), $uri);
}
// hook to get rest api classes from plugins
@@ -370,7 +370,7 @@ class WebApplication
foreach ($plugin as $class) {
if (class_exists($class['namespace'])) {
$this->rest->addAPIClass($class['namespace']);
$this->rest->addAPIClass($class['namespace'], strtolower($pluginName));
}
}
}

View File

@@ -1408,7 +1408,7 @@ class PMPluginRegistry
// Ensure that is registering only existent classes.
if (class_exists($ns)) {
$this->_restServices[strtolower($sNamespace)][] = array(
$this->_restServices[$sNamespace][] = array(
"filepath" => $classFile,
"namespace" => $ns
);