PluginProbe
Yatra – Travel Booking & Tour Operator Software / 2.2.10
Yatra – Travel Booking & Tour Operator Software v2.2.10
3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 All 83 releases
yatra / core / Admin / Settings / Integrations.php

Integrations.php in Yatra – Travel Booking & Tour Operator Software 2.2.10, at core/Admin/Settings/Integrations.php

228 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yatra\Core\Admin\Settings;
4
5
6 /**
7 * Integrations
8 */
9 class Integrations extends \Yatra_Admin_Settings_Base
10 {
11
12 /**
13 * Constructor.
14 */
15 public function __construct()
16 {
17 $this->id = 'integrations';
18 $this->label = __('Integrations', 'yatra');
19
20 parent::__construct();
21 }
22
23 /**
24 * Get sections.
25 *
26 * @return array
27 */
28 public function get_sections()
29 {
30 $sections = array(
31 '' => __('CAPTCHA Integration', 'yatra'),
32 );
33
34 return apply_filters('yatra_get_sections_' . $this->id, $sections);
35 }
36
37 /**
38 * Output the settings.
39 */
40 public function output()
41 {
42 global $current_section;
43
44 $settings = $this->get_settings($current_section);
45
46 \Yatra_Admin_Settings::output_fields($settings);
47 }
48
49 /**
50 * Save settings.
51 */
52 public function save()
53 {
54 global $current_section;
55
56 $settings = $this->get_settings($current_section);
57 \Yatra_Admin_Settings::save_fields($settings);
58
59 if ($current_section) {
60 do_action('yatra_update_options_' . $this->id . '_' . $current_section);
61 }
62 }
63
64 private function get_captcha_language()
65 {
66
67
68 return [
69
70 "ar" => "Arabic",
71 "af" => "Afrikaans",
72 "am" => "Amharic",
73 "hy" => "Armenian",
74 "az" => "Azerbaijani",
75 "eu" => "Basque",
76 "bn" => "Bengali",
77 "bg" => "Bulgarian",
78 "ca" => "Catalan",
79 "zh-HK" => "Chinese (Hong Kong)",
80 "zh-CN" => "Chinese (Simplified)",
81 "zh-TW" => "Chinese (Traditional)",
82 "hr" => "Croatian",
83 "cs" => "Czech",
84 "da" => "Danish",
85 "nl" => "Dutch *",
86 "en-GB" => "English (UK)",
87 "en" => "English (US) *",
88 "et" => "Estonian",
89 "fil" => "Filipino",
90 "fi" => "Finnish",
91 "fr" => "French *",
92 "fr-CA" => "French (Canadian)",
93 "gl" => "Galician",
94 "ka" => "Georgian",
95 "de" => "German *",
96 "de-AT" => "German (Austria)",
97 "de-CH" => "German (Switzerland)",
98 "el" => "Greek",
99 "gu" => "Gujarati",
100 "iw" => "Hebrew",
101 "hi" => "Hindi",
102 "hu" => "Hungarain",
103 "is" => "Icelandic",
104 "id" => "Indonesian",
105 "it" => "Italian *",
106 "ja" => "Japanese",
107 "kn" => "Kannada",
108 "ko" => "Korean",
109 "lo" => "Laothian",
110 "lv" => "Latvian",
111 "lt" => "Lithuanian",
112 "ms" => "Malay",
113 "ml" => "Malayalam",
114 "mr" => "Marathi",
115 "mn" => "Mongolian",
116 "no" => "Norwegian",
117 "fa" => "Persian",
118 "pl" => "Polish",
119 "pt" => "Portuguese *",
120 "pt-BR" => "Portuguese (Brazil)",
121 "pt-PT" => "Portuguese (Portugal)",
122 "ro" => "Romanian",
123 "ru" => "Russian",
124 "sr" => "Serbian",
125 "si" => "Sinhalese",
126 "sk" => "Slovak",
127 "sl" => "Slovenian",
128 "es" => "Spanish *",
129 "es-419" => "Spanish (Latin America)",
130 "sw" => "Swahili",
131 "sv" => "Swedish",
132 "ta" => "Tamil",
133 "te" => "Telugu",
134 "th" => "Thai",
135 "tr" => "Turkish",
136 "uk" => "Ukrainian",
137 "ur" => "Urdu",
138 "vi" => "Vietnamese",
139 "zu" => "Zulu",
140 ];
141
142
143 }
144
145 /**
146 * Get settings array.
147 *
148 * @param string $current_section Current section name.
149 * @return array
150 */
151 public function get_settings($current_section = '')
152 {
153
154
155 $language = $this->get_captcha_language();
156
157
158 return apply_filters('yatra_get_settings_' . $this->id, array(
159 array(
160 'title' => __('CAPTCHA Settings', 'yatra'),
161 'type' => 'title',
162 'desc' => '',
163 'id' => 'yatra_checkout_captcha_options',
164 ),
165 array(
166 'title' => __('CAPTCHA type', 'yatra'),
167 'desc' => sprintf(__('Get detailed of %s reCAPTCHA %s', 'yatra'), "<a target='_blank' href='https://www.google.com/recaptcha/about/'>", '</a>'),
168 'id' => 'yatra_integration_captcha_type',
169 'type' => 'select',
170 'default' => 'recaptcha_v3',
171 'options' => array(
172 'recaptcha_v3' => 'reCAPTCHA v3'
173 )
174 ),
175 array(
176 'title' => __('Enable CAPTCHA on enquiry form', 'yatra'),
177 'desc' => __('Enable CAPTCHA on enquiry form', 'yatra'),
178 'id' => 'yatra_integration_captcha_on_enquiry_form',
179 'type' => 'checkbox',
180 'default' => 'no',
181 ),
182 array(
183 'title' => __('Enable CAPTCHA on booking form', 'yatra'),
184 'desc' => __('Enable CAPTCHA on booking form', 'yatra'),
185 'id' => 'yatra_integration_captcha_on_booking_form',
186 'type' => 'checkbox',
187 'default' => 'no',
188 ),
189 array(
190 'title' => __('Site Key', 'yatra'),
191 'desc' => sprintf(__('Make sure to use the correct site key for the CAPTCHA to avoid issues with form submission. Get %s reCAPTCHA Site Key%s', 'yatra'), "<a target='_blank' href='https://www.google.com/recaptcha/about/'>", '</a>'),
192 'id' => 'yatra_integration_captcha_site_key',
193 'type' => 'text',
194 'default' => '',
195 ),
196 array(
197 'title' => __('Secret Key', 'yatra'),
198 'desc' => sprintf(__('Make sure to use the correct secret key for the CAPTCHA to avoid issues with form submission. Get %s reCAPTCHA Site Key%s', 'yatra'), "<a target='_blank' href='https://www.google.com/recaptcha/about/'>", '</a>'),
199 'id' => 'yatra_integration_captcha_secret_key',
200 'type' => 'text',
201 'default' => '',
202 ),
203 array(
204 'title' => __('Threshold Score', 'yatra'),
205 'id' => 'yatra_integration_captcha_v3_threshold_score',
206 'type' => 'number',
207 'default' => '0.4',
208 'custom_attributes' => array(
209 'max' => '1',
210 'min' => '0',
211 'step' => '0.1'
212 )
213 ),
214 // array(
215 // 'title' => __('CAPTCHA Language', 'yatra'),
216 // 'id' => 'yatra_integration_captcha_language',
217 // 'type' => 'select',
218 // 'default' => 'en',
219 // 'options' => $language
220 // ),
221 array(
222 'type' => 'sectionend',
223 'id' => 'yatra_checkout_captcha_options',
224 ),
225
226 ), $current_section);
227 }
228 }