OptionsManager = new OptionsManager(); $this->Loader = $loader; } public function GetCurrency() { $currency = $this->OptionsManager->GetOption('RednaoCurrency', ''); if ($currency == '') return array( 'Format' => '%1$s%2$s', 'Decimals' => "2", 'ThousandSeparator' => ",", 'DecimalSeparator' => ".", 'Symbol' => "$" ); return $currency; } /** * @return object|LogOptions */ public function GetLog() { $log = $this->OptionsManager->GetOption('RednaoFormLog', ''); if ($log == '') return (object) array( 'Enable' => false, "LogType" => 0 ); return $log; } public function SaveLog($log) { $this->OptionsManager->SaveOptions('RednaoFormLog', $log); } public function SaveCurrency($currency) { $this->OptionsManager->SaveOptions('RednaoCurrency', $currency); } public function GetGoogleMapsApiKey() { return $this->OptionsManager->GetOption('GoogleApiKey', ''); } public function SetGoogleMapsApiKey($apiKey) { $this->OptionsManager->SaveOptions('GoogleApiKey', $apiKey); } public function SaveRecaptchaSettings($settings) { $this->OptionsManager->SaveOptions('RNRecaptchaSettings', $settings); } public function SaveAIModels($models) { $this->OptionsManager->SaveOptions('RNAIModels', $models); } /** * @return RecaptchaSettings */ public function GetRecaptchaSettings() { $recaptcha = $this->OptionsManager->GetOption('RNRecaptchaSettings', ''); if ($recaptcha == '') { return (object) array( 'Type' => '', 'SiteKey' => '', 'SecretKey' => '', 'MinimumScore' => '.4' ); } return $recaptcha; } public function GetRecaptchaPublicSettings() { $recaptcha = $this->OptionsManager->GetOption('RNRecaptchaSettings', ''); if ($recaptcha == '') { return (object) array( 'Type' => '', 'SiteKey' => '' ); } unset($recaptcha->SecretKey); return $recaptcha; } /** FormStatus */ public function GetFormStatusList() { return array( new FormStatus('pending_payment', __('Pending Payment')), new FormStatus('awaiting_approval', __('Awaiting Approval')), new FormStatus('failed_payment', __('Failed Payment')), new FormStatus('processing', __('Processing')), new FormStatus('cancelled', __('Cancelled')), new FormStatus('refunded', __('Refunded')), new FormStatus('onhold', __('OnHold')), new FormStatus('completed', __('Completed')) ); } public function GetAIModels() { return $this->OptionsManager->GetOption('RNAIModels', []); } public function GetModelNames() { $models = $this->GetAIModels(); $names = []; // Define the desired display order $order = ['gemini25pro' => 0, 'gemini3' => 1, 'gemini3pro' => 2, 'deepseek' => 3, 'openai' => 4]; foreach ($models as $model) { $label = $model->Name; switch ($model->Name) { case 'deepseek': $label = 'DeepSeek'; break; case 'openai': $label = 'gpt-4o-mini (OpenAI)'; break; case 'gemini3': $label = 'Gemini 3 Flash'; break; case 'gemini3pro': $label = 'Gemini 3 Pro'; break; case 'gemini25pro': $label = 'Gemini 2.5 Pro'; break; } $names[] = [ 'Name' => $model->Name, 'Label' => $label ]; } // Sort by the defined order usort($names, function ($a, $b) use ($order) { $orderA = isset($order[$a['Name']]) ? $order[$a['Name']] : 999; $orderB = isset($order[$b['Name']]) ? $order[$b['Name']] : 999; return $orderA - $orderB; }); return $names; } public function GetAPIKeyByName($name) { $models = $this->GetAIModels(); foreach ($models as $model) { if ($model->Name == $name) return $model->APIKey; } return ''; } public function GetDefaultModel() { $models = $this->GetAIModels(); foreach ($models as $model) { if ($model->Default) return $model; } if (count($models) > 0) return $models[0]; return null; } } class FormStatus { public $Label; public $Type; public function __construct($type, $label) { $this->Label = $label; $this->Type = $type; } } class RecaptchaSettings { public $Type; public $SiteKey; public $SecretKey; public $MinimumScore; }