public function loadPluginsRegistry($pluginFolder, $confFolder)
 {
     $this->pluginFolder = $pluginFolder;
     $this->confFolder = $confFolder;
     $handler = opendir($pluginFolder);
     $beforeSort = array();
     if ($handler) {
         while (($item = readdir($handler)) !== false) {
             if ($item == "." || $item == ".." || !is_dir($pluginFolder . "/" . $item) || strstr($item, ".") === false) {
                 continue;
             }
             $plugin = new AJXP_Plugin($item, $pluginFolder . "/" . $item);
             $plugin->loadManifest();
             if ($plugin->manifestLoaded()) {
                 $beforeSort[$plugin->getId()] = $plugin;
             }
         }
         closedir($handler);
     }
     if (count($beforeSort)) {
         $this->checkDependencies($beforeSort);
         $this->usort($beforeSort);
         foreach ($beforeSort as $plugin) {
             $plugType = $plugin->getType();
             if (!isset($this->registry[$plugType])) {
                 $this->registry[$plugType] = array();
             }
             $plugin = $this->instanciatePluginClass($plugin);
             if (is_file($this->confFolder . "/conf." . $plugin->getId() . ".inc")) {
                 $plugin->loadConfig($this->confFolder . "/conf." . $plugin->getId() . ".inc", "inc");
             }
             $this->registry[$plugType][$plugin->getName()] = $plugin;
         }
     }
 }
 /**
  * Load plugin class with dependencies first
  *
  * @param AJXP_Plugin $plugin
  * @param array $pluginsPool
  */
 private function recursiveLoadPlugin($plugin, $pluginsPool)
 {
     if ($plugin->loadingState != "") {
         return;
     }
     $dependencies = $plugin->getDependencies();
     $plugin->loadingState = "lock";
     foreach ($dependencies as $dependencyId) {
         if (isset($pluginsPool[$dependencyId])) {
             $this->recursiveLoadPlugin($pluginsPool[$dependencyId], $pluginsPool);
         } else {
             if (strpos($dependencyId, "+") !== false) {
                 foreach (array_keys($pluginsPool) as $pId) {
                     if (strpos($pId, str_replace("+", "", $dependencyId)) === 0) {
                         $this->recursiveLoadPlugin($pluginsPool[$pId], $pluginsPool);
                     }
                 }
             }
         }
     }
     $plugType = $plugin->getType();
     if (!isset($this->registry[$plugType])) {
         $this->registry[$plugType] = array();
     }
     $options = $this->confStorage->loadPluginConfig($plugType, $plugin->getName());
     if ($plugin->isEnabled() || isset($options["AJXP_PLUGIN_ENABLED"]) && $options["AJXP_PLUGIN_ENABLED"] === true) {
         $plugin = $this->instanciatePluginClass($plugin);
     }
     $plugin->loadConfigs($options);
     $this->registry[$plugType][$plugin->getName()] = $plugin;
     $plugin->loadingState = "loaded";
 }
 /**
  * Load plugin class with dependencies first
  *
  * @param AJXP_Plugin $plugin
  * @param array $pluginsPool
  */
 private function recursiveLoadPlugin($plugin, $pluginsPool)
 {
     if ($plugin->loadingState != "") {
         return;
     }
     $dependencies = $plugin->getDependencies();
     $plugin->loadingState = "lock";
     foreach ($dependencies as $dependencyId) {
         if (isset($pluginsPool[$dependencyId])) {
             $this->recursiveLoadPlugin($pluginsPool[$dependencyId], $pluginsPool);
         }
     }
     $plugType = $plugin->getType();
     if (!isset($this->registry[$plugType])) {
         $this->registry[$plugType] = array();
     }
     $plugin = $this->instanciatePluginClass($plugin);
     $options = $this->confStorage->loadPluginConfig($plugType, $plugin->getName());
     $plugin->loadConfigs($options);
     $this->registry[$plugType][$plugin->getName()] = $plugin;
     $plugin->loadingState = "loaded";
 }
 /**
  * Load plugin class with dependencies first
  *
  * @param AJXP_Plugin $plugin
  */
 private function recursiveLoadPlugin($plugin, $pluginsPool)
 {
     if ($plugin->loadingState != "") {
         //print("<div style='padding-left:30px;'>--- Pluging ".$plugin->getId()." already loaded</div>");
         return;
     }
     //print("<div style='padding-left:30px;'>--- Loading ".$plugin->getId());
     $dependencies = $plugin->getDependencies();
     $plugin->loadingState = "lock";
     foreach ($dependencies as $dependencyId) {
         if (isset($pluginsPool[$dependencyId])) {
             $this->recursiveLoadPlugin($pluginsPool[$dependencyId], $pluginsPool);
         }
     }
     $plugType = $plugin->getType();
     if (!isset($this->registry[$plugType])) {
         $this->registry[$plugType] = array();
     }
     $plugin = $this->instanciatePluginClass($plugin);
     if (is_file($this->confFolder . "/conf." . $plugin->getId() . ".inc")) {
         $plugin->loadConfig($this->confFolder . "/conf." . $plugin->getId() . ".inc", "inc");
     }
     $this->registry[$plugType][$plugin->getName()] = $plugin;
     $plugin->loadingState = "loaded";
     //print("</div>");
 }