_settings = $registry->get( 'model.settings' ); $this->_theme_loader = $registry->get( 'theme.loader' ); } /** * Returns settings array. * * @param bool $enable_rendering Whether setting HTML will be rendered or not. * * @return array Array of settings. */ abstract public function get_settings( $enable_rendering = true ); /** * Returns captcha challenge. * * @return mixed */ abstract public function get_challenge(); /** * Validates challenge. * * @param array Challenge response data. * * @return mixed */ abstract public function validate_challenge( array $data ); /** * Returns provider name. * * @return string */ abstract public function get_name(); /** * Returns whether provider is properly configured or not. * * @return bool */ public function is_configured() { if ( null !== $this->_is_configured ) { return $this->_is_configured; } $this->_is_configured = true; foreach ( $this->get_settings() as $key => $setting ) { $value = $this->_settings->get( $key ); if ( empty( $value ) ) { $this->_is_configured = false; break; } } return $this->_is_configured; } }