public function loadPlugin($app, $folder, $optional = false) { if (!file_exists(Util::getRootPath() . "{$app}/{$folder}/plugin.xml") and !$optional) { throw new Exception("Required plugin {$app}/{$folder} not available (1)"); } if (!file_exists(Util::getRootPath() . "{$app}/{$folder}/plugin.xml")) { return false; } $xml = new XMLPlugin(Util::getRootPath() . "{$app}/{$folder}/plugin.xml"); $allowedPlugins = Environment::getS("allowedPlugins", false); $extraPlugins = Environment::getS("pluginsExtra", false); $allow = false; if ($allowedPlugins !== false and in_array($xml->registerClassName(), $allowedPlugins)) { $allow = true; } if ($extraPlugins !== false and in_array($xml->registerClassName(), $extraPlugins)) { $allow = true; } if ($allowedPlugins !== false and !$allow) { if (!$optional) { throw new Exception("Required plugin {$app}/{$folder} not available (2)"); } return false; } require_once Util::getRootPath() . "{$app}/{$folder}/" . $xml->registerClassName() . ".class.php"; $this->addClassPath(Util::getRootPath() . "{$app}/{$folder}"); return true; }
public function loadPlugin($app, $folder, $optional = false) { if (!file_exists(Util::getRootPath() . "{$app}/{$folder}/plugin.xml") and !$optional) { throw new Exception("Required plugin {$app}/{$folder} not available"); } if (!file_exists(Util::getRootPath() . "{$app}/{$folder}/plugin.xml")) { return false; } $xml = new XMLPlugin(Util::getRootPath() . "{$app}/{$folder}/plugin.xml"); require_once Util::getRootPath() . "{$app}/{$folder}/" . $xml->registerClassName() . ".class.php"; $this->addClassPath(Util::getRootPath() . "{$app}/{$folder}"); return true; }