read()) { if ((str_starts_with($entry, '.')) || ($entry === basename(__FILE__))) { continue; } include_once(__DIR__ . '/' . $entry); } } /** * Returns a list of CaptchaProvider objects. * * @return CaptchaProvider[] providers (id => provider object) */ public function findProviders(): array { $this->includeFiles(); $providers = []; foreach (get_declared_classes() as $declaredClass) { if (in_array('LAM\PLUGINS\CAPTCHA\CaptchaProvider', class_implements($declaredClass))) { $provider = new $declaredClass(); $providers[$provider->getId()] = $provider; } } return $providers; } } /** * Interface for providers of captchas. * * @package LAM\PLUGINS\CAPTCHAS */ interface CaptchaProvider { /** * Returns the label of the service * * @return string label */ public function getLabel(): string; /** * Returns the id of the service * * @return string id */ public function getId(): string; /** * Returns the HTML element to render for the captcha. * * @param string $siteKey site key * @return htmlElement HTML element */ public function getCaptchaElement(string $siteKey): htmlElement; /** * Checks if the POST data contains a valid captcha result. * * @param string $secretKey secret key * @param string $siteKey site key * @return bool user solved captcha */ public function isValid(string $secretKey, string $siteKey): bool; }