private \Joomla\CMS\Plugin\CMSPlugin
loadPluginFromFilesystem
(string $plugin, string $type)
private function loadPluginFromFilesystem(string $plugin, string $type)
{
$dispatcher = $this->getContainer()->get(DispatcherInterface::class);
$plugin = preg_replace('/[^A-Z0-9_\\.-]/i', '', $plugin);
$type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
$path = JPATH_PLUGINS . '/' . $type . '/' . $plugin . '/' . $plugin . '.php';
if (!is_file($path)) {
return new DummyPlugin($dispatcher);
}
require_once $path;
$className = 'Plg' . str_replace('-', '', $type) . $plugin;
if ($type === 'editors-xtd') {
$className = 'PlgEditorsXtd' . $plugin;
if (!class_exists($className)) {
$className = 'PlgButton' . $plugin;
}
}
if (!class_exists($className)) {
return new DummyPlugin($dispatcher);
}
return new $className($dispatcher, (array) PluginHelper::getPlugin($type, $plugin));
}