HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vm8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: afleverb (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/www/drakkar_site_dev/wp-content/plugins/formidable/classes/factories/FrmCaptchaFactory.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	die( 'You are not allowed to call this page directly.' );
}

/**
 * @since 6.8.4
 */
class FrmCaptchaFactory {

	/**
	 * Get the proper FrmFieldCaptchaSettings child class based on a type setting.
	 *
	 * @since 6.8.4
	 *
	 * @param string $captcha_type Either 'active', 'recaptcha', 'hcaptcha' or 'turnstile'. If active, the global setting will be used.
	 * @return FrmFieldCaptchaSettings
	 */
	public static function get_settings_object( $captcha_type = 'active' ) {
		$frm_settings = FrmAppHelper::get_settings();

		if ( 'active' === $captcha_type ) {
			$class = self::get_settings_class( $frm_settings->active_captcha );
		} else {
			$class = self::get_settings_class( $captcha_type );
		}

		return new $class( $frm_settings );
	}

	/**
	 * @since 6.8.4
	 *
	 * @param string $active_captcha
	 * @return string
	 */
	private static function get_settings_class( $active_captcha ) {
		$settings_classes = array(
			'recaptcha' => 'FrmRecaptchaSettings',
			'hcaptcha'  => 'FrmHcaptchaSettings',
			'turnstile' => 'FrmTurnstileSettings',
		);

		if ( ! isset( $settings_classes[ $active_captcha ] ) ) {
			$active_captcha = 'recaptcha';
		}

		return $settings_classes[ $active_captcha ];
	}
}