Improve PluginManager code (#5023)
This commit is contained in:
parent
600fbd7cfa
commit
b1d41caf03
|
|
@ -208,21 +208,17 @@ class PluginManager
|
|||
*/
|
||||
public function registerPlugin($plugin, $pluginId = null)
|
||||
{
|
||||
if (!$pluginId) {
|
||||
$pluginId = $this->getIdentifier($plugin);
|
||||
}
|
||||
|
||||
if (!$plugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the provided plugin should be registered
|
||||
*/
|
||||
if ($plugin->disabled || (self::$noInit && !$plugin->elevated)) {
|
||||
if (!$plugin || $plugin->disabled || (self::$noInit && !$plugin->elevated)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$pluginId) {
|
||||
$pluginId = $this->getIdentifier($plugin);
|
||||
}
|
||||
|
||||
$pluginPath = $this->getPluginPath($plugin);
|
||||
$pluginNamespace = strtolower($pluginId);
|
||||
|
||||
|
|
@ -609,7 +605,7 @@ class PluginManager
|
|||
{
|
||||
$code = $this->getIdentifier($id);
|
||||
$code = $this->normalizeIdentifier($code);
|
||||
if (array_key_exists($code, $this->disabledPlugins)) {
|
||||
if (isset($this->disabledPlugins[$code])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -634,7 +630,7 @@ class PluginManager
|
|||
{
|
||||
$code = $this->getIdentifier($id);
|
||||
$code = $this->normalizeIdentifier($code);
|
||||
if (!array_key_exists($code, $this->disabledPlugins)) {
|
||||
if (!isset($this->disabledPlugins[$code])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue