diff --git a/src/Yosymfony/Spress/Plugin/PluginManager.php b/src/Yosymfony/Spress/Plugin/PluginManager.php index 90877bd..e91b6ca 100644 --- a/src/Yosymfony/Spress/Plugin/PluginManager.php +++ b/src/Yosymfony/Spress/Plugin/PluginManager.php @@ -82,19 +82,23 @@ public function dispatchEvent($eventName, Event $event = null) public function getPlugins() { $result = []; + $dir = $this->contentLocator->getPluginDir(); - $finder = new Finder(); - $finder->files() - ->in($this->contentLocator->getPluginDir()) - ->name('*.php'); - - foreach($finder as $file) + if($dir) { - $className = $file->getBasename('.php'); - - if($this->isValidClassName($className)) + $finder = new Finder(); + $finder->files() + ->in($dir) + ->name('*.php'); + + foreach($finder as $file) { - $result[] = new PluginItem(new $className); + $className = $file->getBasename('.php'); + + if($this->isValidClassName($className)) + { + $result[] = new PluginItem(new $className); + } } }