This commit is contained in:
the-djmaze 2022-04-29 11:30:11 +02:00
parent 3522f76d37
commit 1dccfdba3b
4 changed files with 95 additions and 65 deletions

View file

@ -52,7 +52,6 @@ class ChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
}
}
} else {
// foreach (\glob(__DIR__ . '/../change-password-*', GLOB_ONLYDIR) as $file) {
foreach (\glob(__DIR__ . '/drivers/*.php') as $file) {
$name = \basename($file, '.php');
$class = 'ChangePasswordDriver' . $name;
@ -71,6 +70,25 @@ class ChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
}
}
}
foreach (\glob(__DIR__ . '/../change-password-*', GLOB_ONLYDIR) as $file) {
$name = \str_replace('change-password-', '', \basename($file));
$class = "ChangePassword{$name}Driver";
$file .= '/driver.php';
try
{
if (\is_readable($file) && ($all || $this->Config()->Get('plugin', "driver_{$name}_enabled", false))) {
require_once $file;
if ($class::isSupported()) {
yield $name => $class;
}
}
}
catch (\Throwable $oException)
{
\trigger_error("ERROR {$class}: " . $oException->getMessage());
}
}
}
public function Supported() : string