PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.3
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.3
3.6.0 3.5.3 3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / includes / evf-core-functions.php
everest-forms / includes Last commit date
Helpers 1 year ago Integrations 1 week ago RestApi 1 month ago abilities 1 month ago abstracts 1 month ago admin 1 week ago blocks 1 year ago elementor 2 years ago export 3 months ago fields 1 week ago interfaces 8 years ago libraries 2 years ago log-handlers 1 year ago shortcodes 1 month ago stats 6 months ago templates 4 months ago traits 1 month ago class-everest-forms.php 1 week ago class-evf-addon-upsell.php 1 month ago class-evf-ajax.php 1 week ago class-evf-autoloader.php 8 years ago class-evf-background-process-import-entries.php 2 years ago class-evf-background-updater.php 8 years ago class-evf-cache-helper.php 3 months ago class-evf-cron.php 2 years ago class-evf-deprecated-action-hooks.php 6 years ago class-evf-deprecated-filter-hooks.php 5 years ago class-evf-email-entries-report.php 4 months ago class-evf-emails.php 1 month ago class-evf-fields.php 1 month ago class-evf-form-handler.php 1 month ago class-evf-form-task.php 1 month ago class-evf-forms-features.php 1 month ago class-evf-frontend-scripts.php 1 month ago class-evf-install.php 3 months ago class-evf-integrations.php 4 months ago class-evf-log-levels.php 8 years ago class-evf-logger.php 5 years ago class-evf-post-types.php 1 year ago class-evf-privacy.php 6 years ago class-evf-report-cron.php 3 months ago class-evf-reporting.php 3 months ago class-evf-session-handler.php 7 years ago class-evf-shortcodes.php 1 year ago class-evf-smart-tags.php 10 months ago class-evf-template-loader.php 1 year ago class-evf-validation.php 6 years ago evf-conditional-functions.php 6 years ago evf-core-functions.php 1 month ago evf-deprecated-functions.php 6 years ago evf-entry-functions.php 5 months ago evf-formatting-functions.php 4 years ago evf-notice-functions.php 4 years ago evf-template-functions.php 4 years ago evf-template-hooks.php 8 years ago evf-update-functions.php 5 years ago
evf-core-functions.php
5730 lines
1 <?php
2
3 /**
4 * EverestForms Core Functions
5 *
6 * General core functions available on both the front-end and admin.
7 *
8 * @package EverestForms/Functions
9 * @version 1.0.0
10 */
11
12 defined('ABSPATH') || exit;
13
14 // Include core functions (available in both admin and frontend).
15 require EVF_ABSPATH . 'includes/evf-conditional-functions.php';
16 require EVF_ABSPATH . 'includes/evf-deprecated-functions.php';
17 require EVF_ABSPATH . 'includes/evf-formatting-functions.php';
18 require EVF_ABSPATH . 'includes/evf-entry-functions.php';
19
20 /**
21 * Define a constant if it is not already defined.
22 *
23 * @since 1.0.0
24 * @param string $name Constant name.
25 * @param mixed $value Value.
26 */
27 function evf_maybe_define_constant($name, $value)
28 {
29 if (! defined($name)) {
30 define($name, $value);
31 }
32 }
33
34 /**
35 * Get template part.
36 *
37 * EVF_TEMPLATE_DEBUG_MODE will prevent overrides in themes from taking priority.
38 *
39 * @param mixed $slug Template slug.
40 * @param string $name Template name (default: '').
41 */
42 function evf_get_template_part($slug, $name = '')
43 {
44 $cache_key = sanitize_key(implode('-', array('template-part', $slug, $name, EVF_VERSION)));
45 $template = (string) wp_cache_get($cache_key, 'everest-forms');
46
47 if (! $template) {
48 if ($name) {
49 $template = EVF_TEMPLATE_DEBUG_MODE ? '' : locate_template(
50 array(
51 "{$slug}-{$name}.php",
52 evf()->template_path() . "{$slug}-{$name}.php",
53 )
54 );
55
56 if (! $template) {
57 $fallback = evf()->plugin_path() . "/templates/{$slug}-{$name}.php";
58 $template = file_exists($fallback) ? $fallback : '';
59 }
60 }
61
62 if (! $template) {
63 // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/everest-forms/slug.php.
64 $template = EVF_TEMPLATE_DEBUG_MODE ? '' : locate_template(
65 array(
66 "{$slug}.php",
67 evf()->template_path() . "{$slug}.php",
68 )
69 );
70 }
71
72 wp_cache_set($cache_key, $template, 'everest-forms');
73 }
74
75 // Allow 3rd party plugins to filter template file from their plugin.
76 $template = apply_filters('evf_get_template_part', $template, $slug, $name);
77
78 if ($template) {
79 load_template($template, false);
80 }
81 }
82
83 /**
84 * Get other templates passing attributes and including the file.
85 *
86 * @param string $template_name Template name.
87 * @param array $args Arguments. (default: array).
88 * @param string $template_path Template path. (default: '').
89 * @param string $default_path Default path. (default: '').
90 */
91 function evf_get_template($template_name, $args = array(), $template_path = '', $default_path = '')
92 {
93 $cache_key = sanitize_key(implode('-', array('template', $template_name, $template_path, $default_path, EVF_VERSION)));
94 $template = (string) wp_cache_get($cache_key, 'everest-forms');
95
96 if (! $template) {
97 $template = evf_locate_template($template_name, $template_path, $default_path);
98 wp_cache_set($cache_key, $template, 'everest-forms');
99 }
100
101 // Allow 3rd party plugin filter template file from their plugin.
102 $filter_template = apply_filters('evf_get_template', $template, $template_name, $args, $template_path, $default_path);
103
104 if ($filter_template !== $template) {
105 if (! file_exists($filter_template)) {
106 /* translators: %s template */
107 evf_doing_it_wrong(__FUNCTION__, sprintf(__('%s does not exist.', 'everest-forms'), '<code>' . $filter_template . '</code>'), '1.0.0');
108 return;
109 }
110 $template = $filter_template;
111 }
112
113 $action_args = array(
114 'template_name' => $template_name,
115 'template_path' => $template_path,
116 'located' => $template,
117 'args' => $args,
118 );
119
120 if (! empty($args) && is_array($args)) {
121 if (isset($args['action_args'])) {
122 evf_doing_it_wrong(
123 __FUNCTION__,
124 __('action_args should not be overwritten when calling evf_get_template.', 'everest-forms'),
125 '1.4.9'
126 );
127 unset($args['action_args']);
128 }
129 extract($args); // @codingStandardsIgnoreLine
130 }
131
132 do_action('everest_forms_before_template_part', $action_args['template_name'], $action_args['template_path'], $action_args['located'], $action_args['args']);
133
134 include $action_args['located'];
135
136 do_action('everest_forms_after_template_part', $action_args['template_name'], $action_args['template_path'], $action_args['located'], $action_args['args']);
137 }
138
139 /**
140 * Like evf_get_template, but returns the HTML instead of outputting.
141 *
142 * @see evf_get_template
143 * @since 1.0.0
144 * @param string $template_name Template name.
145 * @param array $args Arguments. (default: array).
146 * @param string $template_path Template path. (default: '').
147 * @param string $default_path Default path. (default: '').
148 * @return string
149 */
150 function evf_get_template_html($template_name, $args = array(), $template_path = '', $default_path = '')
151 {
152 ob_start();
153 evf_get_template($template_name, $args, $template_path, $default_path);
154 return ob_get_clean();
155 }
156
157 /**
158 * Locate a template and return the path for inclusion.
159 *
160 * This is the load order:
161 *
162 * yourtheme/$template_path/$template_name
163 * yourtheme/$template_name
164 * $default_path/$template_name
165 *
166 * @param string $template_name Template name.
167 * @param string $template_path Template path. (default: '').
168 * @param string $default_path Default path. (default: '').
169 * @return string
170 */
171 function evf_locate_template($template_name, $template_path = '', $default_path = '')
172 {
173 if (! $template_path) {
174 $template_path = evf()->template_path();
175 }
176
177 if (! $default_path) {
178 $default_path = evf()->plugin_path() . '/templates/';
179 }
180
181 // Look within passed path within the theme - this is priority.
182 $template = locate_template(
183 array(
184 trailingslashit($template_path) . $template_name,
185 $template_name,
186 )
187 );
188
189 // Get default template/.
190 if (! $template || EVF_TEMPLATE_DEBUG_MODE) {
191 $template = $default_path . $template_name;
192 }
193
194 // Return what we found.
195 return apply_filters('everest_forms_locate_template', $template, $template_name, $template_path);
196 }
197
198 /**
199 * Send HTML emails from EverestForms.
200 *
201 * @param mixed $to Receiver.
202 * @param mixed $subject Subject.
203 * @param mixed $message Message.
204 * @param string $headers Headers. (default: "Content-Type: text/html\r\n").
205 * @param string $attachments Attachments. (default: "").
206 */
207 function evf_mail($to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = '')
208 {
209 $mailer = evf()->mailer();
210
211 $mailer->send($to, $subject, $message, $headers, $attachments);
212 }
213
214 /**
215 * Queue some JavaScript code to be output in the footer.
216 *
217 * @param string $code Code.
218 */
219 function evf_enqueue_js($code)
220 {
221 global $evf_queued_js;
222
223 if (empty($evf_queued_js)) {
224 $evf_queued_js = '';
225 }
226
227 $evf_queued_js .= "\n" . $code . "\n";
228 }
229
230 /**
231 * Output any queued javascript code in the footer.
232 */
233 function evf_print_js()
234 {
235 global $evf_queued_js;
236
237 if (! empty($evf_queued_js)) {
238 // Sanitize.
239 $evf_queued_js = wp_check_invalid_utf8($evf_queued_js);
240 $evf_queued_js = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", $evf_queued_js);
241 $evf_queued_js = str_replace("\r", '', $evf_queued_js);
242
243 $js = "<!-- Everest Forms JavaScript -->\n<script type=\"text/javascript\">\njQuery(function($) { $evf_queued_js });\n</script>\n";
244
245 /**
246 * Queued jsfilter.
247 *
248 * @since 1.0.0
249 * @param string $js JavaScript code.
250 */
251 echo wp_kses(apply_filters('everest_forms_queued_js', $js), array('script' => array('type' => true)));
252 unset($evf_queued_js);
253 }
254 }
255
256 /**
257 * Set a cookie - wrapper for setcookie using WP constants.
258 *
259 * @param string $name Name of the cookie being set.
260 * @param string $value Value of the cookie.
261 * @param integer $expire Expiry of the cookie.
262 * @param bool $secure Whether the cookie should be served only over https.
263 * @param bool $httponly Whether the cookie is only accessible over HTTP, not scripting languages like JavaScript. @since 1.4.9.
264 */
265 function evf_setcookie($name, $value, $expire = 0, $secure = false, $httponly = false)
266 {
267 if (! headers_sent()) {
268 setcookie($name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, apply_filters('everest_forms_cookie_httponly', $httponly, $name, $value, $expire, $secure));
269 } elseif (defined('WP_DEBUG') && WP_DEBUG) {
270 headers_sent($file, $line);
271 trigger_error("{$name} cookie cannot be set - headers already sent by {$file} on line {$line}", E_USER_NOTICE); // @codingStandardsIgnoreLine
272 }
273 }
274
275 /**
276 * Get a log file path.
277 *
278 * @since 1.0.0
279 *
280 * @param string $handle name.
281 * @return string the log file path.
282 */
283 function evf_get_log_file_path($handle)
284 {
285 return EVF_Log_Handler_File::get_log_file_path($handle);
286 }
287
288 /**
289 * Get a csv file name.
290 *
291 * File names consist of the handle, followed by the date, followed by a hash, .csv.
292 *
293 * @since 1.3.0
294 *
295 * @param string $handle Name.
296 * @param string $extension Extension Type.
297 * @return bool|string The csv file name or false if cannot be determined.
298 */
299 function evf_get_entry_export_file_name($handle, $extension = 'csv')
300 {
301 if (function_exists('wp_hash')) {
302 $date_suffix = date_i18n('Y-m-d', time());
303 $hash_suffix = wp_hash($handle);
304 return sanitize_file_name(implode('-', array('evf-entry-export', $handle, $date_suffix, $hash_suffix)) . '.' . $extension);
305 } else {
306 evf_doing_it_wrong(__METHOD__, __('This method should not be called before plugins_loaded.', 'everest-forms'), '1.3.0');
307 return false;
308 }
309 }
310
311 /**
312 * Recursively get page children.
313 *
314 * @param int $page_id Page ID.
315 * @return int[]
316 */
317 function evf_get_page_children($page_id)
318 {
319 $page_ids = get_posts(
320 array(
321 'post_parent' => $page_id,
322 'post_type' => 'page',
323 'numberposts' => -1,
324 'post_status' => 'any',
325 'fields' => 'ids',
326 )
327 );
328
329 if (! empty($page_ids)) {
330 foreach ($page_ids as $page_id) {
331 $page_ids = array_merge($page_ids, evf_get_page_children($page_id));
332 }
333 }
334
335 return $page_ids;
336 }
337
338 /**
339 * Get user agent string.
340 *
341 * @since 1.0.0
342 * @return string
343 */
344 function evf_get_user_agent()
345 {
346 return isset($_SERVER['HTTP_USER_AGENT']) ? evf_clean(wp_unslash($_SERVER['HTTP_USER_AGENT'])) : ''; // @codingStandardsIgnoreLine
347 }
348
349 // This function can be removed when WP 3.9.2 or greater is required.
350 if (! function_exists('hash_equals')) :
351 /**
352 * Compare two strings in constant time.
353 *
354 * This function was added in PHP 5.6.
355 * It can leak the length of a string.
356 *
357 * @since 1.0.0
358 *
359 * @param string $a Expected string.
360 * @param string $b Actual string.
361 * @return bool Whether strings are equal.
362 */
363 function hash_equals($a, $b)
364 {
365 $a_length = strlen($a);
366 if (strlen($b) !== $a_length) {
367 return false;
368 }
369 $result = 0;
370
371 // Do not attempt to "optimize" this.
372 for ($i = 0; $i < $a_length; $i++) {
373 $result |= ord($a[$i]) ^ ord($b[$i]);
374 }
375
376 return 0 === $result;
377 }
378 endif;
379
380 /**
381 * Generate a rand hash.
382 *
383 * @since 1.0.0
384 * @return string
385 */
386 function evf_rand_hash()
387 {
388 if (! function_exists('openssl_random_pseudo_bytes')) {
389 return sha1(wp_rand());
390 }
391
392 return bin2hex(openssl_random_pseudo_bytes(20)); // @codingStandardsIgnoreLine
393 }
394
395 /**
396 * Find all possible combinations of values from the input array and return in a logical order.
397 *
398 * @since 1.0.0
399 * @param array $input Input.
400 * @return array
401 */
402 function evf_array_cartesian($input)
403 {
404 $input = array_filter($input);
405 $results = array();
406 $indexes = array();
407 $index = 0;
408
409 // Generate indexes from keys and values so we have a logical sort order.
410 foreach ($input as $key => $values) {
411 foreach ($values as $value) {
412 $indexes[$key][$value] = $index++;
413 }
414 }
415
416 // Loop over the 2D array of indexes and generate all combinations.
417 foreach ($indexes as $key => $values) {
418 // When result is empty, fill with the values of the first looped array.
419 if (empty($results)) {
420 foreach ($values as $value) {
421 $results[] = array($key => $value);
422 }
423 } else {
424 // Second and subsequent input sub-array merging.
425 foreach ($results as $result_key => $result) {
426 foreach ($values as $value) {
427 // If the key is not set, we can set it.
428 if (! isset($results[$result_key][$key])) {
429 $results[$result_key][$key] = $value;
430 } else {
431 // If the key is set, we can add a new combination to the results array.
432 $new_combination = $results[$result_key];
433 $new_combination[$key] = $value;
434 $results[] = $new_combination;
435 }
436 }
437 }
438 }
439 }
440
441 // Sort the indexes.
442 arsort($results);
443
444 // Convert indexes back to values.
445 foreach ($results as $result_key => $result) {
446 $converted_values = array();
447
448 // Sort the values.
449 arsort($results[$result_key]);
450
451 // Convert the values.
452 foreach ($results[$result_key] as $key => $value) {
453 $converted_values[$key] = array_search($value, $indexes[$key], true);
454 }
455
456 $results[$result_key] = $converted_values;
457 }
458
459 return $results;
460 }
461
462 /**
463 * Run a MySQL transaction query, if supported.
464 *
465 * @since 1.0.0
466 * @param string $type Types: start (default), commit, rollback.
467 * @param bool $force use of transactions.
468 */
469 function evf_transaction_query($type = 'start', $force = false)
470 {
471 global $wpdb;
472
473 $wpdb->hide_errors();
474
475 evf_maybe_define_constant('EVF_USE_TRANSACTIONS', true);
476
477 if (EVF_USE_TRANSACTIONS || $force) {
478 switch ($type) {
479 case 'commit':
480 $wpdb->query('COMMIT');
481 break;
482 case 'rollback':
483 $wpdb->query('ROLLBACK');
484 break;
485 default:
486 $wpdb->query('START TRANSACTION');
487 break;
488 }
489 }
490 }
491
492 /**
493 * Outputs a "back" link so admin screens can easily jump back a page.
494 *
495 * @param string $label Title of the page to return to.
496 * @param string $url URL of the page to return to.
497 */
498 function evf_back_link($label, $url)
499 {
500 echo '<small class="evf-admin-breadcrumb"><a href="' . esc_url($url) . '" aria-label="' . esc_attr($label) . '">&#x2934;</a></small>';
501 }
502
503 /**
504 * Display a EverestForms help tip.
505 *
506 * @since 1.0.0
507 *
508 * @param string $tip Help tip text.
509 * @param bool $allow_html Allow sanitized HTML if true or escape.
510 * @return string
511 */
512 function evf_help_tip($tip, $allow_html = false)
513 {
514 if ($allow_html) {
515 $tip = evf_sanitize_tooltip($tip);
516 } else {
517 $tip = esc_attr($tip);
518 }
519
520 return '<span class="everest-forms-help-tip" data-tip="' . $tip . '"></span>';
521 }
522
523 /**
524 * Wrapper for set_time_limit to see if it is enabled.
525 *
526 * @since 1.0.0
527 * @param int $limit Time limit.
528 */
529 function evf_set_time_limit($limit = 0)
530 {
531 if (function_exists('set_time_limit') && false === strpos(ini_get('disable_functions'), 'set_time_limit') && ! ini_get('safe_mode')) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
532 @set_time_limit($limit); // @codingStandardsIgnoreLine
533 }
534 }
535
536 /**
537 * Wrapper for nocache_headers which also disables page caching.
538 *
539 * @since 1.2.0
540 */
541 function evf_nocache_headers()
542 {
543 EVF_Cache_Helper::set_nocache_constants();
544 nocache_headers();
545 }
546
547 /**
548 * Get a shared logger instance.
549 *
550 * Use the everest_forms_logging_class filter to change the logging class. You may provide one of the following:
551 * - a class name which will be instantiated as `new $class` with no arguments
552 * - an instance which will be used directly as the logger
553 * In either case, the class or instance *must* implement EVF_Logger_Interface.
554 *
555 * @see EVF_Logger_Interface
556 *
557 * @return EVF_Logger
558 */
559 function evf_get_logger()
560 {
561 static $logger = null;
562
563 $class = apply_filters('everest_forms_logging_class', 'EVF_Logger');
564
565 if (null !== $logger && is_string($class) && is_a($logger, $class)) {
566 return $logger;
567 }
568
569 $implements = class_implements($class);
570
571 if (is_array($implements) && in_array('EVF_Logger_Interface', $implements, true)) {
572 $logger = is_object($class) ? $class : new $class();
573 } else {
574 evf_doing_it_wrong(
575 __FUNCTION__,
576 sprintf(
577 /* translators: 1: class name 2: everest_forms_logging_class 3: EVF_Logger_Interface */
578 __('The class %1$s provided by %2$s filter must implement %3$s.', 'everest-forms'),
579 '<code>' . esc_html(is_object($class) ? get_class($class) : $class) . '</code>',
580 '<code>everest_forms_logging_class</code>',
581 '<code>EVF_Logger_Interface</code>'
582 ),
583 '1.2'
584 );
585 $logger = is_a($logger, 'EVF_Logger') ? $logger : new EVF_Logger();
586 }
587
588 return $logger;
589 }
590
591 /**
592 * Prints human-readable information about a variable.
593 *
594 * Some server environments blacklist some debugging functions. This function provides a safe way to
595 * turn an expression into a printable, readable form without calling blacklisted functions.
596 *
597 * @since 1.0.0
598 *
599 * @param mixed $expression The expression to be printed.
600 * @param bool $return Optional. Default false. Set to true to return the human-readable string.
601 *
602 * @return string|bool False if expression could not be printed. True if the expression was printed.
603 * If $return is true, a string representation will be returned.
604 */
605 function evf_print_r($expression, $return = false)
606 {
607 $alternatives = array(
608 array(
609 'func' => 'print_r',
610 'args' => array($expression, true),
611 ),
612 array(
613 'func' => 'var_export',
614 'args' => array($expression, true),
615 ),
616 array(
617 'func' => 'json_encode',
618 'args' => array($expression),
619 ),
620 array(
621 'func' => 'serialize',
622 'args' => array($expression),
623 ),
624 );
625
626 $alternatives = apply_filters('everest_forms_print_r_alternatives', $alternatives, $expression);
627
628 foreach ($alternatives as $alternative) {
629 if (function_exists($alternative['func'])) {
630 $res = call_user_func_array($alternative['func'], $alternative['args']);
631 if ($return) {
632 return $res;
633 }
634
635 echo wp_kses_post($res);
636 return true;
637 }
638 }
639
640 return false;
641 }
642
643 /**
644 * Registers the default log handler.
645 *
646 * @since 1.0.0
647 * @param array $handlers Handlers.
648 * @return array
649 */
650 function evf_register_default_log_handler($handlers)
651 {
652 if (defined('EVF_LOG_HANDLER') && class_exists(EVF_LOG_HANDLER)) {
653 $handler_class = EVF_LOG_HANDLER;
654 $default_handler = new $handler_class();
655 } else {
656 $default_handler = new EVF_Log_Handler_File();
657 }
658
659 array_push($handlers, $default_handler);
660
661 return $handlers;
662 }
663
664 add_filter('everest_forms_register_log_handlers', 'evf_register_default_log_handler');
665
666 /**
667 * Based on wp_list_pluck, this calls a method instead of returning a property.
668 *
669 * @since 1.0.0
670 * @param array $list List of objects or arrays.
671 * @param int|string $callback_or_field Callback method from the object to place instead of the entire object.
672 * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
673 * Default null.
674 * @return array Array of values.
675 */
676 function evf_list_pluck($list, $callback_or_field, $index_key = null)
677 {
678 // Use wp_list_pluck if this isn't a callback.
679 $first_el = current($list);
680 if (! is_object($first_el) || ! is_callable(array($first_el, $callback_or_field))) {
681 return wp_list_pluck($list, $callback_or_field, $index_key);
682 }
683 if (! $index_key) {
684 /*
685 * This is simple. Could at some point wrap array_column()
686 * if we knew we had an array of arrays.
687 */
688 foreach ($list as $key => $value) {
689 $list[$key] = $value->{$callback_or_field}();
690 }
691 return $list;
692 }
693
694 /*
695 * When index_key is not set for a particular item, push the value
696 * to the end of the stack. This is how array_column() behaves.
697 */
698 $newlist = array();
699 foreach ($list as $value) {
700 // Get index.
701 if (is_callable(array($value, $index_key))) {
702 $newlist[$value->{$index_key}()] = $value->{$callback_or_field}();
703 } elseif (isset($value->$index_key)) {
704 $newlist[$value->$index_key] = $value->{$callback_or_field}();
705 } else {
706 $newlist[] = $value->{$callback_or_field}();
707 }
708 }
709 return $newlist;
710 }
711
712 /**
713 * Switch EverestForms to site language.
714 *
715 * @since 1.0.0
716 */
717 function evf_switch_to_site_locale()
718 {
719 if (function_exists('switch_to_locale')) {
720 switch_to_locale(get_locale());
721
722 // Filter on plugin_locale so load_plugin_textdomain loads the correct locale.
723 add_filter('plugin_locale', 'get_locale');
724
725 // Init EVF locale.
726 evf()->load_plugin_textdomain();
727 }
728 }
729
730 /**
731 * Switch EverestForms language to original.
732 *
733 * @since 1.0.0
734 */
735 function evf_restore_locale()
736 {
737 if (function_exists('restore_previous_locale')) {
738 restore_previous_locale();
739
740 // Remove filter.
741 remove_filter('plugin_locale', 'get_locale');
742
743 // Init EVF locale.
744 evf()->load_plugin_textdomain();
745 }
746 }
747
748 /**
749 * Get an item of post data if set, otherwise return a default value.
750 *
751 * @since 1.0.0
752 * @param string $key Key.
753 * @param string $default Default.
754 * @return mixed value sanitized by evf_clean
755 */
756 function evf_get_post_data_by_key($key, $default = '')
757 {
758 return evf_clean(evf_get_var($_POST[$key], $default)); // @codingStandardsIgnoreLine
759 }
760
761 /**
762 * Get data if set, otherwise return a default value or null. Prevents notices when data is not set.
763 *
764 * @since 1.0.0
765 * @param mixed $var Variable.
766 * @param string $default Default value.
767 * @return mixed
768 */
769 function evf_get_var(&$var, $default = null)
770 {
771 return isset($var) ? $var : $default;
772 }
773
774 /**
775 * Read in EverestForms headers when reading plugin headers.
776 *
777 * @since 1.2.0
778 * @param array $headers Headers.
779 * @return array
780 */
781 function evf_enable_evf_plugin_headers($headers)
782 {
783 if (! class_exists('EVF_Plugin_Updates')) {
784 include_once __DIR__ . '/admin/plugin-updates/class-evf-plugin-updates.php';
785 }
786
787 // EVF requires at least - allows developers to define which version of Everest Forms the plugin requires to run.
788 $headers[] = EVF_Plugin_Updates::VERSION_REQUIRED_HEADER;
789
790 // EVF tested up to - allows developers to define which version of Everest Forms they have tested up to.
791 $headers[] = EVF_Plugin_Updates::VERSION_TESTED_HEADER;
792
793 return $headers;
794 }
795 add_filter('extra_theme_headers', 'evf_enable_evf_plugin_headers');
796 add_filter('extra_plugin_headers', 'evf_enable_evf_plugin_headers');
797
798 /**
799 * Delete expired transients.
800 *
801 * Deletes all expired transients. The multi-table delete syntax is used.
802 * to delete the transient record from table a, and the corresponding.
803 * transient_timeout record from table b.
804 *
805 * Based on code inside core's upgrade_network() function.
806 *
807 * @since 1.0.0
808 * @return int Number of transients that were cleared.
809 */
810 function evf_delete_expired_transients()
811 {
812 global $wpdb;
813
814 $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
815 WHERE a.option_name LIKE %s
816 AND a.option_name NOT LIKE %s
817 AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )
818 AND b.option_value < %d";
819 $rows = $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_') . '%', $wpdb->esc_like('_transient_timeout_') . '%', time())); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
820
821 $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
822 WHERE a.option_name LIKE %s
823 AND a.option_name NOT LIKE %s
824 AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )
825 AND b.option_value < %d";
826 $rows2 = $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_site_transient_') . '%', $wpdb->esc_like('_site_transient_timeout_') . '%', time())); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
827
828 return absint($rows + $rows2);
829 }
830 add_action('everest_forms_installed', 'evf_delete_expired_transients');
831
832 /**
833 * Make a URL relative, if possible.
834 *
835 * @since 1.0.0
836 * @param string $url URL to make relative.
837 * @return string
838 */
839 function evf_get_relative_url($url)
840 {
841 return evf_is_external_resource($url) ? $url : str_replace(array('http://', 'https://'), '//', $url);
842 }
843
844 /**
845 * See if a resource is remote.
846 *
847 * @since 1.0.0
848 * @param string $url URL to check.
849 * @return bool
850 */
851 function evf_is_external_resource($url)
852 {
853 $wp_base = str_replace(array('http://', 'https://'), '//', get_home_url(null, '/', 'http'));
854 return strstr($url, '://') && strstr($wp_base, $url);
855 }
856
857 /**
858 * See if theme/s is activate or not.
859 *
860 * @since 1.0.0
861 * @param string|array $theme Theme name or array of theme names to check.
862 * @return boolean
863 */
864 function evf_is_active_theme($theme)
865 {
866 return is_array($theme) ? in_array(get_template(), $theme, true) : get_template() === $theme;
867 }
868
869 /**
870 * Cleans up session data - cron callback.
871 *
872 * @since 1.0.0
873 */
874 function evf_cleanup_session_data()
875 {
876 $session_class = apply_filters('everest_forms_session_handler', 'EVF_Session_Handler');
877 $session = new $session_class();
878
879 if (is_callable(array($session, 'cleanup_sessions'))) {
880 $session->cleanup_sessions();
881 }
882 }
883 add_action('everest_forms_cleanup_sessions', 'evf_cleanup_session_data');
884
885 /**
886 * Return the html selected attribute if stringified $value is found in array of stringified $options
887 * or if stringified $value is the same as scalar stringified $options.
888 *
889 * @param string|int $value Value to find within options.
890 * @param string|int|array $options Options to go through when looking for value.
891 * @return string
892 */
893 function evf_selected($value, $options)
894 {
895 if (is_array($options)) {
896 $options = array_map('strval', $options);
897 return selected(in_array((string) $value, $options, true), true, false);
898 }
899
900 return selected($value, $options, false);
901 }
902
903 /**
904 * Retrieve actual fields from a form.
905 *
906 * Non-posting elements such as section divider, page break, and HTML are
907 * automatically excluded. Optionally a white list can be provided.
908 *
909 * @since 1.0.0
910 *
911 * @param mixed $form Form data.
912 * @param array $whitelist Whitelist args.
913 *
914 * @return mixed boolean or array
915 */
916 function evf_get_form_fields($form = false, $whitelist = array())
917 {
918 // Accept form (post) object or form ID.
919 if (is_object($form)) {
920 $form = json_decode($form->post_content);
921 } elseif (is_numeric($form)) {
922 $form = evf()->form->get(
923 $form,
924 array(
925 'content_only' => true,
926 )
927 );
928 }
929
930 if (! is_array($form) || empty($form['form_fields'])) {
931 return false;
932 }
933
934 // White list of field types to allow.
935 $allowed_form_fields = array(
936 'first-name',
937 'last-name',
938 'text',
939 'textarea',
940 'select',
941 'radio',
942 'checkbox',
943 'email',
944 'address',
945 'country',
946 'url',
947 'name',
948 'hidden',
949 'date',
950 'phone',
951 'number',
952 'file-upload',
953 'image-upload',
954 'payment-single',
955 'payment-multiple',
956 'payment-checkbox',
957 'payment-total',
958 );
959 $allowed_form_fields = apply_filters('everest_forms_allowed_form_fields', $allowed_form_fields);
960
961 $whitelist = ! empty($whitelist) ? $whitelist : $allowed_form_fields;
962
963 $form_fields = $form['form_fields'];
964
965 foreach ($form_fields as $id => $form_field) {
966 if (! in_array($form_field['type'], $whitelist, true)) {
967 unset($form_fields[$id]);
968 }
969 }
970
971 return $form_fields;
972 }
973
974 /**
975 * Sanitize a string, that can be a multiline.
976 * If WP core `sanitize_textarea_field()` exists (after 4.7.0) - use it.
977 * Otherwise - split onto separate lines, sanitize each one, merge again.
978 *
979 * @since 1.4.1
980 *
981 * @param string $string Raw string to sanitize.
982 *
983 * @return string If empty var is passed, or not a string - return unmodified. Otherwise - sanitize.
984 */
985 function evf_sanitize_textarea_field($string)
986 {
987 if (empty($string) || ! is_string($string)) {
988 return $string;
989 }
990
991 if (function_exists('sanitize_textarea_field')) {
992 $string = sanitize_textarea_field($string);
993 } else {
994 $string = implode("\n", array_map('sanitize_text_field', explode("\n", $string)));
995 }
996
997 return $string;
998 }
999
1000 /**
1001 * Formats, sanitizes, and returns/echos HTML element ID, classes, attributes,
1002 * and data attributes.
1003 *
1004 * @param string $id Element ID.
1005 * @param array $class Class args.
1006 * @param array $datas Data args.
1007 * @param array $atts Attributes.
1008 * @param bool $echo True to echo else return.
1009 *
1010 * @return string
1011 */
1012 function evf_html_attributes($id = '', $class = array(), $datas = array(), $atts = array(), $echo = false)
1013 {
1014 $id = trim($id);
1015 $parts = array();
1016
1017 $is_edit_entry = isset($_GET['edit-entry']) && ! sanitize_text_field(wp_unslash(empty($_GET['edit-entry']))) ? true : false;
1018
1019 if (! empty($id)) {
1020 $id = sanitize_html_class($id);
1021 if (! empty($id)) {
1022 $parts[] = 'id="' . $id . '"';
1023 }
1024 }
1025
1026 if (! empty($class)) {
1027 $class = evf_sanitize_classes($class, true);
1028 if (! empty($class)) {
1029 // While editing hidden field should be visible.
1030 if ($is_edit_entry) {
1031 $class = str_replace('evf-field-hidden', '', $class);
1032 }
1033 $parts[] = 'class="' . $class . '"';
1034 }
1035 }
1036
1037 if (! empty($datas)) {
1038 foreach ($datas as $data => $val) {
1039 $parts[] = 'data-' . sanitize_html_class($data) . '="' . esc_attr($val) . '"';
1040 }
1041 }
1042
1043 if (! empty($atts)) {
1044 foreach ($atts as $att => $val) {
1045 if ('0' === $val || ! empty($val)) {
1046 if ($att[0] === '[') { //phpcs:ignore
1047 // Handle special case for bound attributes in AMP.
1048 $escaped_att = '[' . sanitize_html_class(trim($att, '[]')) . ']';
1049 } else {
1050 $escaped_att = sanitize_html_class($att);
1051 }
1052 // While editing, fields must be visible even if they are hidden.
1053 if ('style' == $escaped_att && $is_edit_entry) {
1054 $parts[] = 'style = "display: block"';
1055 } else {
1056 $parts[] = $escaped_att . '="' . esc_attr($val) . '"';
1057 }
1058 }
1059 }
1060 }
1061
1062 $output = implode(' ', $parts);
1063
1064 if ($echo) {
1065 echo esc_html(trim($output));
1066 } else {
1067 return trim($output);
1068 }
1069 }
1070
1071 /**
1072 * Sanitize string of CSS classes.
1073 *
1074 * @param array|string $classes Class names.
1075 * @param bool $convert True will convert strings to array and vice versa.
1076 *
1077 * @return string|array
1078 */
1079 function evf_sanitize_classes($classes, $convert = false)
1080 {
1081 $css = array();
1082 $array = is_array($classes);
1083
1084 if (! empty($classes)) {
1085 if (! $array) {
1086 $classes = explode(' ', trim($classes));
1087 }
1088 foreach ($classes as $class) {
1089 $css[] = sanitize_html_class($class);
1090 }
1091 }
1092
1093 if ($array) {
1094 return $convert ? implode(' ', $css) : $css;
1095 } else {
1096 return $convert ? $css : implode(' ', $css);
1097 }
1098 }
1099
1100 /**
1101 * Performs json_decode and unslash.
1102 *
1103 * @since 1.0.0
1104 *
1105 * @param string $data Data to decode.
1106 *
1107 * @return array|bool
1108 */
1109 function evf_decode($data)
1110 {
1111 if (! $data || empty($data)) {
1112 return false;
1113 }
1114
1115 return json_decode($data, true);
1116 }
1117
1118 /**
1119 * Performs json_encode and wp_slash.
1120 *
1121 * @since 1.0.0
1122 *
1123 * @param mixed $data Data to encode.
1124 *
1125 * @return string
1126 */
1127 function evf_encode($data = false)
1128 {
1129 if (empty($data)) {
1130 return false;
1131 }
1132
1133 return wp_slash(wp_json_encode($data));
1134 }
1135
1136 /**
1137 * Crypto rand secure.
1138 *
1139 * @param int $min Min value.
1140 * @param int $max Max value.
1141 *
1142 * @return mixed
1143 */
1144 function evf_crypto_rand_secure($min, $max)
1145 {
1146 $range = $max - $min;
1147 if ($range < 1) {
1148 return $min;
1149 } // not so random...
1150 $log = ceil(log($range, 2));
1151 $bytes = (int) ($log / 8) + 1; // Length in bytes.
1152 $bits = (int) $log + 1; // Length in bits.
1153 $filter = (int) (1 << $bits) - 1; // Set all lower bits to 1.
1154 do {
1155 $rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes)));
1156 $rnd = $rnd & $filter; // Discard irrelevant bits.
1157 } while ($rnd > $range);
1158
1159 return $min + $rnd;
1160 }
1161
1162 /**
1163 * Generate random string.
1164 *
1165 * @param int $length Length of string.
1166 *
1167 * @return string
1168 */
1169 function evf_get_random_string($length = 10)
1170 {
1171 $string = '';
1172 $code_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1173 $code_alphabet .= 'abcdefghijklmnopqrstuvwxyz';
1174 $code_alphabet .= '0123456789';
1175 $max = strlen($code_alphabet);
1176 for ($i = 0; $i < $length; $i++) {
1177 $string .= $code_alphabet[evf_crypto_rand_secure(0, $max - 1)];
1178 }
1179
1180 return $string;
1181 }
1182
1183 /**
1184 * Get all forms.
1185 *
1186 * @param bool $skip_disabled_entries True to skip disabled entries.
1187 * @param bool $check_disable_storing_entry_info Check disable storing entry.
1188 * @return array of form data.
1189 */
1190 function evf_get_all_forms( $skip_disabled_entries = false, $check_disable_storing_entry_info = true, $is_zapier_request = false ) {
1191 if ( is_null( evf()->form ) ) {
1192 return array();
1193 }
1194 $forms = array();
1195 $form_ids = wp_parse_id_list(
1196 evf()->form->get_multiple(
1197 array(
1198 'fields' => 'ids',
1199 'status' => 'publish',
1200 'order' => 'DESC',
1201 'numberposts' => -1, // @codingStandardsIgnoreLine
1202 )
1203 )
1204 );
1205
1206 if (! empty($form_ids)) {
1207 foreach ($form_ids as $form_id) {
1208 $form = evf()->form->get($form_id);
1209 $entries = evf_get_entries_ids($form_id);
1210 $form_data = ! empty($form->post_content) ? evf_decode($form->post_content) : '';
1211
1212 if (! $form || ($skip_disabled_entries && count($entries) < 1) && (isset($form_data['settings']['disabled_entries']) && '1' === $form_data['settings']['disabled_entries'])) {
1213 if (! $form || $check_disable_storing_entry_info) {
1214 continue;
1215 }
1216 }
1217
1218 // Check permissions for forms with viewable.
1219 if ( current_user_can( 'everest_forms_view_form_entries', $form_id ) || $is_zapier_request ) {
1220 $forms[ $form_id ] = $form->post_title;
1221 }
1222 }
1223 }
1224
1225 return $forms;
1226 }
1227
1228 /**
1229 * Get random meta-key for field option.
1230 *
1231 * @param array $field Field data array.
1232 * @return string
1233 */
1234 function evf_get_meta_key_field_option($field)
1235 {
1236 if (isset($field['type']) && isset($field['label'])) {
1237 switch ($field['type']) {
1238 case 'select':
1239 $field['label'] = 'Dropdown';
1240 break;
1241 case 'radio':
1242 $field['label'] = 'Multiple Choice';
1243 break;
1244 case 'checkbox':
1245 $field['label'] = 'Checkboxes';
1246 break;
1247 }
1248 }
1249 return str_replace(' ', '_', preg_replace('/[^a-zA-Z0-9\s`_]/', '', strtolower($field['label']))) . '_' . rand(pow(10, 3), pow(10, 4) - 1); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_rand.
1250 }
1251
1252 /**
1253 * Get current user IP Address.
1254 *
1255 * @return string
1256 */
1257 function evf_get_ip_address() {
1258 if ( isset( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ) { // WPCS: input var ok, CSRF ok.
1259 return sanitize_text_field( wp_unslash( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ); // WPCS: input var ok, CSRF ok.
1260 }
1261
1262 if ( isset( $_SERVER['HTTP_TRUE_CLIENT_IP'] ) ) { // WPCS: input var ok, CSRF ok.
1263 return sanitize_text_field( wp_unslash( $_SERVER['HTTP_TRUE_CLIENT_IP'] ) ); // WPCS: input var ok, CSRF ok.
1264 }
1265
1266 if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ) { // WPCS: input var ok, CSRF ok.
1267 return sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REAL_IP'] ) ); // WPCS: input var ok, CSRF ok.
1268 }
1269
1270 if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { // WPCS: input var ok, CSRF ok.
1271 // Proxy servers can send through this header like this: X-Forwarded-For: client1, proxy1, proxy2
1272 // Make sure we always only send through the first IP in the list which should always be the client IP.
1273 $ip = trim( current( preg_split( '/[,:]/', sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ) ) );
1274 $validated_ip = rest_is_ip_address( $ip );
1275 if ( $validated_ip ) {
1276 return (string) $validated_ip; // WPCS: input var ok, CSRF ok.
1277 }
1278 }
1279
1280 if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { // @codingStandardsIgnoreLine
1281 return sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ); // @codingStandardsIgnoreLine
1282 }
1283 return '';
1284 }
1285
1286 /**
1287 * Get User Agent browser and OS type
1288 *
1289 * @since 1.1.0
1290 * @return array
1291 */
1292 function evf_get_browser()
1293 {
1294 $u_agent = ! empty($_SERVER['HTTP_USER_AGENT']) ? sanitize_text_field(sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']))) : '';
1295 $bname = 'Unknown';
1296 $platform = 'Unknown';
1297 $version = '';
1298
1299 // First get the platform.
1300 if (preg_match('/linux/i', $u_agent)) {
1301 $platform = 'Linux';
1302 } elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
1303 $platform = 'MAC OS';
1304 } elseif (preg_match('/windows|win32/i', $u_agent)) {
1305 $platform = 'Windows';
1306 }
1307
1308 // Next get the name of the useragent yes seperately and for good reason.
1309 if (preg_match('/MSIE/i', $u_agent) && ! preg_match('/Opera/i', $u_agent)) {
1310 $bname = 'Internet Explorer';
1311 $ub = 'MSIE';
1312 } elseif (preg_match('/Trident/i', $u_agent)) {
1313 // this condition is for IE11.
1314 $bname = 'Internet Explorer';
1315 $ub = 'rv';
1316 } elseif (preg_match('/Firefox/i', $u_agent)) {
1317 $bname = 'Mozilla Firefox';
1318 $ub = 'Firefox';
1319 } elseif (preg_match('/Chrome/i', $u_agent)) {
1320 $bname = 'Google Chrome';
1321 $ub = 'Chrome';
1322 } elseif (preg_match('/Safari/i', $u_agent)) {
1323 $bname = 'Apple Safari';
1324 $ub = 'Safari';
1325 } elseif (preg_match('/Opera/i', $u_agent)) {
1326 $bname = 'Opera';
1327 $ub = 'Opera';
1328 } elseif (preg_match('/Netscape/i', $u_agent)) {
1329 $bname = 'Netscape';
1330 $ub = 'Netscape';
1331 }
1332
1333 // Finally get the correct version number.
1334 // Added "|:".
1335 $known = array('Version', $ub, 'other');
1336 $pattern = '#(?<browser>' . join('|', $known) . ')[/|: ]+(?<version>[0-9.|a-zA-Z.]*)#';
1337 if (! preg_match_all($pattern, $u_agent, $matches)) { // @codingStandardsIgnoreLine
1338 // We have no matching number just continue.
1339 }
1340
1341 // See how many we have.
1342 $i = count($matches['browser']);
1343
1344 if (1 !== $i) {
1345 // we will have two since we are not using 'other' argument yet.
1346 // see if version is before or after the name.
1347 if (strripos($u_agent, 'Version') < strripos($u_agent, $ub)) {
1348 $version = $matches['version'][0];
1349 } else {
1350 $version = $matches['version'][1];
1351 }
1352 } else {
1353 $version = $matches['version'][0];
1354 }
1355
1356 // Check if we have a number.
1357 if (null === $version || '' === $version) {
1358 $version = '';
1359 }
1360
1361 return array(
1362 'userAgent' => $u_agent,
1363 'name' => $bname,
1364 'version' => $version,
1365 'platform' => $platform,
1366 'pattern' => $pattern,
1367 );
1368 }
1369
1370 /**
1371 * Get the certain date of a specified day in a specified format.
1372 *
1373 * @since 1.1.0
1374 *
1375 * @param string $period Supported values: start, end.
1376 * @param string $timestamp Default is the current timestamp, if left empty.
1377 * @param string $format Default is a MySQL format.
1378 *
1379 * @return string
1380 */
1381 function evf_get_day_period_date($period, $timestamp = '', $format = 'Y-m-d H:i:s')
1382 {
1383 $date = '';
1384
1385 if (empty($timestamp)) {
1386 $timestamp = time();
1387 }
1388
1389 switch ($period) {
1390 case 'start_of_day':
1391 $date = date($format, strtotime('today', $timestamp)); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
1392 break;
1393
1394 case 'end_of_day':
1395 $date = date($format, strtotime('tomorrow', $timestamp) - 1); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
1396 break;
1397 }
1398
1399 return $date;
1400 }
1401
1402 /**
1403 * Get field label by meta key
1404 *
1405 * @param int $form_id Form ID.
1406 * @param string $meta_key Field's meta key.
1407 * @param array $fields Entry Field Data.
1408 *
1409 * @return string|false True if field label exists in form.
1410 */
1411 function evf_get_form_data_by_meta_key($form_id, $meta_key, $fields = array())
1412 {
1413 $get_post = get_post($form_id);
1414 $post_content = json_decode($get_post->post_content, true);
1415 $form_fields = isset($post_content['form_fields']) ? $post_content['form_fields'] : array();
1416
1417 if (! empty($form_fields)) {
1418 foreach ($form_fields as $field) {
1419 if (isset($field['meta-key']) && $meta_key === $field['meta-key']) {
1420 return $field['label'];
1421 }
1422 }
1423 }
1424
1425 if (! empty($fields)) {
1426 foreach ($fields as $field) {
1427 if (isset($field->meta_key) && $meta_key === $field->meta_key) {
1428 return isset($field->name) ? $field->name : $field->value->name;
1429 }
1430 }
1431 }
1432
1433 return false;
1434 }
1435
1436 /**
1437 * Get field type by meta key
1438 *
1439 * @param int $form_id Form ID.
1440 * @param string $meta_key Field's meta key.
1441 *
1442 * @return string|false True if field type exists in form.
1443 */
1444 function evf_get_field_type_by_meta_key($form_id, $meta_key)
1445 {
1446 $get_post = get_post($form_id);
1447 $post_content = json_decode($get_post->post_content, true);
1448 $form_fields = isset($post_content['form_fields']) ? $post_content['form_fields'] : array();
1449
1450 if (! empty($form_fields)) {
1451 foreach ($form_fields as $field) {
1452 if (isset($field['meta-key']) && $meta_key === $field['meta-key']) {
1453 return $field['type'];
1454 }
1455 }
1456 }
1457
1458 return false;
1459 }
1460
1461 /**
1462 * Get all the email fields of a Form.
1463 *
1464 * @param int $form_id Form ID.
1465 */
1466 function evf_get_all_email_fields_by_form_id($form_id)
1467 {
1468 $user_emails = array();
1469 $form_obj = evf()->form->get($form_id);
1470 $form_data = ! empty($form_obj->post_content) ? evf_decode($form_obj->post_content) : '';
1471
1472 if (! empty($form_data['form_fields'])) {
1473 foreach ($form_data['form_fields'] as $form_fields) {
1474 if ('email' === $form_fields['type']) {
1475 $user_emails[$form_fields['meta-key']] = $form_fields['label'];
1476 }
1477 }
1478 }
1479
1480 return $user_emails;
1481 }
1482
1483 /**
1484 * Get all the field's meta-key label pair.
1485 *
1486 * @param int $form_id Form ID.
1487 * @return array
1488 */
1489 function evf_get_all_form_fields_by_form_id($form_id)
1490 {
1491 $data = array();
1492 $form_obj = evf()->form->get($form_id);
1493 $form_data = ! empty($form_obj->post_content) ? evf_decode($form_obj->post_content) : '';
1494
1495 if (! empty($form_data['form_fields'])) {
1496 foreach ($form_data['form_fields'] as $form_fields) {
1497 if (isset($form_fields['meta-key'], $form_fields['label'])) {
1498 $data[$form_fields['meta-key']] = $form_fields['label'];
1499 }
1500 }
1501 }
1502
1503 return $data;
1504 }
1505
1506 /**
1507 * Check if the string JSON.
1508 *
1509 * @param string $string String to check.
1510 * @return bool
1511 */
1512 function evf_isJson($string)
1513 {
1514 json_decode($string);
1515 return (json_last_error() == JSON_ERROR_NONE); // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1516 }
1517
1518 /**
1519 * Checks whether the content passed contains a specific short code.
1520 *
1521 * @since 1.1.4
1522 * @param string $tag Shortcode tag to check.
1523 * @return bool
1524 */
1525 function evf_post_content_has_shortcode($tag = '')
1526 {
1527 global $post;
1528
1529 return is_singular() && is_a($post, 'WP_Post') && has_shortcode($post->post_content, $tag);
1530 }
1531
1532 /**
1533 * Convert a file size provided, such as "2M", to bytes.
1534 *
1535 * @since 1.2.0
1536 * @link http://stackoverflow.com/a/22500394
1537 *
1538 * @param string $size Size to convert to bytes.
1539 *
1540 * @return int
1541 */
1542 function evf_size_to_bytes($size)
1543 {
1544 if (is_numeric($size)) {
1545 return $size;
1546 }
1547
1548 $suffix = substr($size, -1);
1549 $value = substr($size, 0, -1);
1550
1551 // @codingStandardsIgnoreStart
1552 switch (strtoupper($suffix)) {
1553 case 'P':
1554 $value *= 1024;
1555 case 'T':
1556 $value *= 1024;
1557 case 'G':
1558 $value *= 1024;
1559 case 'M':
1560 $value *= 1024;
1561 case 'K':
1562 $value *= 1024;
1563 break;
1564 }
1565 // @codingStandardsIgnoreEnd
1566
1567 return $value;
1568 }
1569
1570 /**
1571 * Convert bytes to megabytes (or in some cases KB).
1572 *
1573 * @since 1.2.0
1574 *
1575 * @param int $bytes Bytes to convert to a readable format.
1576 *
1577 * @return string
1578 */
1579 function evf_size_to_megabytes($bytes)
1580 {
1581 if ($bytes < 1048676) {
1582 return number_format($bytes / 1024, 1) . ' KB';
1583 } else {
1584 return round((float) number_format($bytes / 1048576, 1)) . ' MB';
1585 }
1586 }
1587
1588 /**
1589 * Convert a file size provided, such as "2M", to bytes.
1590 *
1591 * @since 1.2.0
1592 * @link http://stackoverflow.com/a/22500394
1593 *
1594 * @param bool $bytes Whether to convert Bytes to a readable format.
1595 * @return mixed
1596 */
1597 function evf_max_upload($bytes = false)
1598 {
1599 $max = wp_max_upload_size();
1600
1601 if ($bytes) {
1602 return $max;
1603 } else {
1604 return evf_size_to_megabytes($max);
1605 }
1606 }
1607
1608 /**
1609 * Get the required label text, with a filter.
1610 *
1611 * @since 1.2.0
1612 * @return string
1613 */
1614 function evf_get_required_label()
1615 {
1616 return apply_filters('everest_forms_required_label', esc_html__('This field is required.', 'everest-forms'));
1617 }
1618
1619 /**
1620 * Get a PRO license plan.
1621 *
1622 * @since 1.2.0
1623 * @return bool|string Plan on success, false on failure.
1624 */
1625 function evf_get_license_plan() {
1626 if (
1627 ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ||
1628 ( defined( 'DOING_CRON' ) && DOING_CRON ) ||
1629 ( defined( 'DOING_AJAX' ) && DOING_AJAX )
1630 ) {
1631 return evf_handle_license_plan_compatibility(
1632 get_option( 'evf_saved_license_plan', 'personal' )
1633 );
1634 }
1635
1636 $license_key = get_option( 'everest-forms-pro_license_key' );
1637
1638 if ( ! function_exists( 'is_plugin_active' ) ) {
1639 include_once ABSPATH . 'wp-admin/includes/plugin.php';
1640 }
1641
1642 if ( ! $license_key || ! is_plugin_active( 'everest-forms-pro/everest-forms-pro.php' ) ) {
1643 return false;
1644 }
1645
1646 $license_data = get_transient( 'evf_pro_license_plan' );
1647
1648 if ( false !== $license_data ) {
1649 $license_plan = isset( $license_data->item_plan )
1650 ? $license_data->item_plan
1651 : get_option( 'evf_saved_license_plan', 'personal' );
1652
1653 return evf_handle_license_plan_compatibility( $license_plan );
1654 }
1655
1656 $license_response = EVF_Updater_Key_API::check( array( 'license' => $license_key ) );
1657
1658 if ( ! $license_response ) {
1659 $saved_plan = get_option( 'evf_saved_license_plan', 'personal' );
1660 set_transient( 'evf_pro_license_plan', (object) array( 'item_plan' => $saved_plan ), HOUR_IN_SECONDS );
1661
1662 return evf_handle_license_plan_compatibility( $saved_plan );
1663 }
1664
1665 $license_data = json_decode( $license_response );
1666
1667 if ( empty( $license_data ) || ! is_object( $license_data ) ) {
1668 $saved_plan = get_option( 'evf_saved_license_plan', 'personal' );
1669 set_transient( 'evf_pro_license_plan', (object) array( 'item_plan' => $saved_plan ), HOUR_IN_SECONDS );
1670
1671 return evf_handle_license_plan_compatibility( $saved_plan );
1672 }
1673
1674 if ( ! empty( $license_data->item_name ) ) {
1675 $item_plan = trim( str_replace(
1676 array( 'everest forms', 'lifetime', '-lifetime' ),
1677 '',
1678 strtolower( $license_data->item_name )
1679 ) );
1680
1681 $license_data->item_plan = $item_plan;
1682
1683 update_option( 'evf_saved_license_plan', $item_plan );
1684 set_transient( 'evf_pro_license_plan', $license_data, WEEK_IN_SECONDS );
1685 }
1686
1687 $license_plan = isset( $license_data->item_plan )
1688 ? $license_data->item_plan
1689 : get_option( 'evf_saved_license_plan', 'personal' );
1690
1691 return evf_handle_license_plan_compatibility( $license_plan );
1692 }
1693
1694 add_action('admin_init', 'evf_handle_force_update');
1695
1696 if (! function_exists('evf_handle_force_update')) {
1697
1698 /**
1699 * Delete our plugins addon updater transient during force update.
1700 */
1701 function evf_handle_force_update()
1702 {
1703 global $pagenow;
1704
1705 if ('update-core.php' === $pagenow && (isset($_GET['force-check'])) && ('1' === $_GET['force-check'])) {
1706 delete_transient('evf_pro_license_plan');
1707 }
1708 }
1709 }
1710
1711
1712 /** To handle the backward compatibility for those user who is still using the plus and professional plan license key.
1713 *
1714 * @since 3.0.0
1715 * @param $license_plan License plan.
1716 */
1717 function evf_handle_license_plan_compatibility($license_plan)
1718 {
1719 $license_plan = ('plus' === $license_plan || 'professional' === $license_plan || 'unknown' === $license_plan) ? 'personal' : $license_plan;
1720 return $license_plan;
1721 }
1722
1723 /**
1724 * Decode special characters, both alpha- (<) and numeric-based (').
1725 *
1726 * @since 1.2.0
1727 *
1728 * @param string $string Raw string to decode.
1729 *
1730 * @return string
1731 */
1732 function evf_decode_string($string)
1733 {
1734 if (! is_string($string)) {
1735 return $string;
1736 }
1737
1738 return wp_kses_decode_entities(html_entity_decode($string, ENT_QUOTES));
1739 }
1740 add_filter('everest_forms_email_message', 'evf_decode_string');
1741
1742 /**
1743 * Get Countries.
1744 *
1745 * @since 1.2.0
1746 * @return array
1747 */
1748 function evf_get_countries()
1749 {
1750 $countries = array(
1751 'AF' => esc_html__('Afghanistan', 'everest-forms'),
1752 'AX' => esc_html__('�
1753 land Islands', 'everest-forms'),
1754 'AL' => esc_html__('Albania', 'everest-forms'),
1755 'DZ' => esc_html__('Algeria', 'everest-forms'),
1756 'AS' => esc_html__('American Samoa', 'everest-forms'),
1757 'AD' => esc_html__('Andorra', 'everest-forms'),
1758 'AO' => esc_html__('Angola', 'everest-forms'),
1759 'AI' => esc_html__('Anguilla', 'everest-forms'),
1760 'AQ' => esc_html__('Antarctica', 'everest-forms'),
1761 'AG' => esc_html__('Antigua and Barbuda', 'everest-forms'),
1762 'AR' => esc_html__('Argentina', 'everest-forms'),
1763 'AM' => esc_html__('Armenia', 'everest-forms'),
1764 'AW' => esc_html__('Aruba', 'everest-forms'),
1765 'AU' => esc_html__('Australia', 'everest-forms'),
1766 'AT' => esc_html__('Austria', 'everest-forms'),
1767 'AZ' => esc_html__('Azerbaijan', 'everest-forms'),
1768 'BS' => esc_html__('Bahamas', 'everest-forms'),
1769 'BH' => esc_html__('Bahrain', 'everest-forms'),
1770 'BD' => esc_html__('Bangladesh', 'everest-forms'),
1771 'BB' => esc_html__('Barbados', 'everest-forms'),
1772 'BY' => esc_html__('Belarus', 'everest-forms'),
1773 'BE' => esc_html__('Belgium', 'everest-forms'),
1774 'PW' => esc_html__('Belau', 'everest-forms'),
1775 'BZ' => esc_html__('Belize', 'everest-forms'),
1776 'BJ' => esc_html__('Benin', 'everest-forms'),
1777 'BM' => esc_html__('Bermuda', 'everest-forms'),
1778 'BT' => esc_html__('Bhutan', 'everest-forms'),
1779 'BO' => esc_html__('Bolivia', 'everest-forms'),
1780 'BQ' => esc_html__('Bonaire, Saint Eustatius and Saba', 'everest-forms'),
1781 'BA' => esc_html__('Bosnia and Herzegovina', 'everest-forms'),
1782 'BW' => esc_html__('Botswana', 'everest-forms'),
1783 'BV' => esc_html__('Bouvet Island', 'everest-forms'),
1784 'BR' => esc_html__('Brazil', 'everest-forms'),
1785 'IO' => esc_html__('British Indian Ocean Territory', 'everest-forms'),
1786 'BN' => esc_html__('Brunei', 'everest-forms'),
1787 'BG' => esc_html__('Bulgaria', 'everest-forms'),
1788 'BF' => esc_html__('Burkina Faso', 'everest-forms'),
1789 'BI' => esc_html__('Burundi', 'everest-forms'),
1790 'KH' => esc_html__('Cambodia', 'everest-forms'),
1791 'CM' => esc_html__('Cameroon', 'everest-forms'),
1792 'CA' => esc_html__('Canada', 'everest-forms'),
1793 'CV' => esc_html__('Cape Verde', 'everest-forms'),
1794 'KY' => esc_html__('Cayman Islands', 'everest-forms'),
1795 'CF' => esc_html__('Central African Republic', 'everest-forms'),
1796 'TD' => esc_html__('Chad', 'everest-forms'),
1797 'CL' => esc_html__('Chile', 'everest-forms'),
1798 'CN' => esc_html__('China', 'everest-forms'),
1799 'CX' => esc_html__('Christmas Island', 'everest-forms'),
1800 'CC' => esc_html__('Cocos (Keeling) Islands', 'everest-forms'),
1801 'CO' => esc_html__('Colombia', 'everest-forms'),
1802 'KM' => esc_html__('Comoros', 'everest-forms'),
1803 'CG' => esc_html__('Congo (Brazzaville)', 'everest-forms'),
1804 'CD' => esc_html__('Congo (Kinshasa)', 'everest-forms'),
1805 'CK' => esc_html__('Cook Islands', 'everest-forms'),
1806 'CR' => esc_html__('Costa Rica', 'everest-forms'),
1807 'HR' => esc_html__('Croatia', 'everest-forms'),
1808 'CU' => esc_html__('Cuba', 'everest-forms'),
1809 'CW' => esc_html__('Cura&ccedil;ao', 'everest-forms'),
1810 'CY' => esc_html__('Cyprus', 'everest-forms'),
1811 'CZ' => esc_html__('Czech Republic', 'everest-forms'),
1812 'DK' => esc_html__('Denmark', 'everest-forms'),
1813 'DJ' => esc_html__('Djibouti', 'everest-forms'),
1814 'DM' => esc_html__('Dominica', 'everest-forms'),
1815 'DO' => esc_html__('Dominican Republic', 'everest-forms'),
1816 'EC' => esc_html__('Ecuador', 'everest-forms'),
1817 'EG' => esc_html__('Egypt', 'everest-forms'),
1818 'SV' => esc_html__('El Salvador', 'everest-forms'),
1819 'GQ' => esc_html__('Equatorial Guinea', 'everest-forms'),
1820 'ER' => esc_html__('Eritrea', 'everest-forms'),
1821 'EE' => esc_html__('Estonia', 'everest-forms'),
1822 'ET' => esc_html__('Ethiopia', 'everest-forms'),
1823 'FK' => esc_html__('Falkland Islands', 'everest-forms'),
1824 'FO' => esc_html__('Faroe Islands', 'everest-forms'),
1825 'FJ' => esc_html__('Fiji', 'everest-forms'),
1826 'FI' => esc_html__('Finland', 'everest-forms'),
1827 'FR' => esc_html__('France', 'everest-forms'),
1828 'GF' => esc_html__('French Guiana', 'everest-forms'),
1829 'PF' => esc_html__('French Polynesia', 'everest-forms'),
1830 'TF' => esc_html__('French Southern Territories', 'everest-forms'),
1831 'GA' => esc_html__('Gabon', 'everest-forms'),
1832 'GM' => esc_html__('Gambia', 'everest-forms'),
1833 'GE' => esc_html__('Georgia', 'everest-forms'),
1834 'DE' => esc_html__('Germany', 'everest-forms'),
1835 'GH' => esc_html__('Ghana', 'everest-forms'),
1836 'GI' => esc_html__('Gibraltar', 'everest-forms'),
1837 'GR' => esc_html__('Greece', 'everest-forms'),
1838 'GL' => esc_html__('Greenland', 'everest-forms'),
1839 'GD' => esc_html__('Grenada', 'everest-forms'),
1840 'GP' => esc_html__('Guadeloupe', 'everest-forms'),
1841 'GU' => esc_html__('Guam', 'everest-forms'),
1842 'GT' => esc_html__('Guatemala', 'everest-forms'),
1843 'GG' => esc_html__('Guernsey', 'everest-forms'),
1844 'GN' => esc_html__('Guinea', 'everest-forms'),
1845 'GW' => esc_html__('Guinea-Bissau', 'everest-forms'),
1846 'GY' => esc_html__('Guyana', 'everest-forms'),
1847 'HT' => esc_html__('Haiti', 'everest-forms'),
1848 'HM' => esc_html__('Heard Island and McDonald Islands', 'everest-forms'),
1849 'HN' => esc_html__('Honduras', 'everest-forms'),
1850 'HK' => esc_html__('Hong Kong', 'everest-forms'),
1851 'HU' => esc_html__('Hungary', 'everest-forms'),
1852 'IS' => esc_html__('Iceland', 'everest-forms'),
1853 'IN' => esc_html__('India', 'everest-forms'),
1854 'ID' => esc_html__('Indonesia', 'everest-forms'),
1855 'IR' => esc_html__('Iran', 'everest-forms'),
1856 'IQ' => esc_html__('Iraq', 'everest-forms'),
1857 'IE' => esc_html__('Ireland', 'everest-forms'),
1858 'IM' => esc_html__('Isle of Man', 'everest-forms'),
1859 'IL' => esc_html__('Israel', 'everest-forms'),
1860 'IT' => esc_html__('Italy', 'everest-forms'),
1861 'CI' => esc_html__('Ivory Coast', 'everest-forms'),
1862 'JM' => esc_html__('Jamaica', 'everest-forms'),
1863 'JP' => esc_html__('Japan', 'everest-forms'),
1864 'JE' => esc_html__('Jersey', 'everest-forms'),
1865 'JO' => esc_html__('Jordan', 'everest-forms'),
1866 'KZ' => esc_html__('Kazakhstan', 'everest-forms'),
1867 'KE' => esc_html__('Kenya', 'everest-forms'),
1868 'KI' => esc_html__('Kiribati', 'everest-forms'),
1869 'KW' => esc_html__('Kuwait', 'everest-forms'),
1870 'XK' => esc_html__('Kosovo', 'everest-forms'),
1871 'KG' => esc_html__('Kyrgyzstan', 'everest-forms'),
1872 'LA' => esc_html__('Laos', 'everest-forms'),
1873 'LV' => esc_html__('Latvia', 'everest-forms'),
1874 'LB' => esc_html__('Lebanon', 'everest-forms'),
1875 'LS' => esc_html__('Lesotho', 'everest-forms'),
1876 'LR' => esc_html__('Liberia', 'everest-forms'),
1877 'LY' => esc_html__('Libya', 'everest-forms'),
1878 'LI' => esc_html__('Liechtenstein', 'everest-forms'),
1879 'LT' => esc_html__('Lithuania', 'everest-forms'),
1880 'LU' => esc_html__('Luxembourg', 'everest-forms'),
1881 'MO' => esc_html__('Macao', 'everest-forms'),
1882 'MK' => esc_html__('North Macedonia', 'everest-forms'),
1883 'MG' => esc_html__('Madagascar', 'everest-forms'),
1884 'MW' => esc_html__('Malawi', 'everest-forms'),
1885 'MY' => esc_html__('Malaysia', 'everest-forms'),
1886 'MV' => esc_html__('Maldives', 'everest-forms'),
1887 'ML' => esc_html__('Mali', 'everest-forms'),
1888 'MT' => esc_html__('Malta', 'everest-forms'),
1889 'MH' => esc_html__('Marshall Islands', 'everest-forms'),
1890 'MQ' => esc_html__('Martinique', 'everest-forms'),
1891 'MR' => esc_html__('Mauritania', 'everest-forms'),
1892 'MU' => esc_html__('Mauritius', 'everest-forms'),
1893 'YT' => esc_html__('Mayotte', 'everest-forms'),
1894 'MX' => esc_html__('Mexico', 'everest-forms'),
1895 'FM' => esc_html__('Micronesia', 'everest-forms'),
1896 'MD' => esc_html__('Moldova', 'everest-forms'),
1897 'MC' => esc_html__('Monaco', 'everest-forms'),
1898 'MN' => esc_html__('Mongolia', 'everest-forms'),
1899 'ME' => esc_html__('Montenegro', 'everest-forms'),
1900 'MS' => esc_html__('Montserrat', 'everest-forms'),
1901 'MA' => esc_html__('Morocco', 'everest-forms'),
1902 'MZ' => esc_html__('Mozambique', 'everest-forms'),
1903 'MM' => esc_html__('Myanmar', 'everest-forms'),
1904 'NA' => esc_html__('Namibia', 'everest-forms'),
1905 'NR' => esc_html__('Nauru', 'everest-forms'),
1906 'NP' => esc_html__('Nepal', 'everest-forms'),
1907 'NL' => esc_html__('Netherlands', 'everest-forms'),
1908 'NC' => esc_html__('New Caledonia', 'everest-forms'),
1909 'NZ' => esc_html__('New Zealand', 'everest-forms'),
1910 'NI' => esc_html__('Nicaragua', 'everest-forms'),
1911 'NE' => esc_html__('Niger', 'everest-forms'),
1912 'NG' => esc_html__('Nigeria', 'everest-forms'),
1913 'NU' => esc_html__('Niue', 'everest-forms'),
1914 'NF' => esc_html__('Norfolk Island', 'everest-forms'),
1915 'MP' => esc_html__('Northern Mariana Islands', 'everest-forms'),
1916 'KP' => esc_html__('North Korea', 'everest-forms'),
1917 'NO' => esc_html__('Norway', 'everest-forms'),
1918 'OM' => esc_html__('Oman', 'everest-forms'),
1919 'PK' => esc_html__('Pakistan', 'everest-forms'),
1920 'PS' => esc_html__('Palestinian Territory', 'everest-forms'),
1921 'PA' => esc_html__('Panama', 'everest-forms'),
1922 'PG' => esc_html__('Papua New Guinea', 'everest-forms'),
1923 'PY' => esc_html__('Paraguay', 'everest-forms'),
1924 'PE' => esc_html__('Peru', 'everest-forms'),
1925 'PH' => esc_html__('Philippines', 'everest-forms'),
1926 'PN' => esc_html__('Pitcairn', 'everest-forms'),
1927 'PL' => esc_html__('Poland', 'everest-forms'),
1928 'PT' => esc_html__('Portugal', 'everest-forms'),
1929 'PR' => esc_html__('Puerto Rico', 'everest-forms'),
1930 'QA' => esc_html__('Qatar', 'everest-forms'),
1931 'RE' => esc_html__('Reunion', 'everest-forms'),
1932 'RO' => esc_html__('Romania', 'everest-forms'),
1933 'RU' => esc_html__('Russia', 'everest-forms'),
1934 'RW' => esc_html__('Rwanda', 'everest-forms'),
1935 'BL' => esc_html__('Saint Barth&eacute;lemy', 'everest-forms'),
1936 'SH' => esc_html__('Saint Helena', 'everest-forms'),
1937 'KN' => esc_html__('Saint Kitts and Nevis', 'everest-forms'),
1938 'LC' => esc_html__('Saint Lucia', 'everest-forms'),
1939 'MF' => esc_html__('Saint Martin (French part)', 'everest-forms'),
1940 'SX' => esc_html__('Saint Martin (Dutch part)', 'everest-forms'),
1941 'PM' => esc_html__('Saint Pierre and Miquelon', 'everest-forms'),
1942 'VC' => esc_html__('Saint Vincent and the Grenadines', 'everest-forms'),
1943 'SM' => esc_html__('San Marino', 'everest-forms'),
1944 'ST' => esc_html__('S&atilde;o Tom&eacute; and Pr&iacute;ncipe', 'everest-forms'),
1945 'SA' => esc_html__('Saudi Arabia', 'everest-forms'),
1946 'SN' => esc_html__('Senegal', 'everest-forms'),
1947 'RS' => esc_html__('Serbia', 'everest-forms'),
1948 'SC' => esc_html__('Seychelles', 'everest-forms'),
1949 'SL' => esc_html__('Sierra Leone', 'everest-forms'),
1950 'SG' => esc_html__('Singapore', 'everest-forms'),
1951 'SK' => esc_html__('Slovakia', 'everest-forms'),
1952 'SI' => esc_html__('Slovenia', 'everest-forms'),
1953 'SB' => esc_html__('Solomon Islands', 'everest-forms'),
1954 'SO' => esc_html__('Somalia', 'everest-forms'),
1955 'ZA' => esc_html__('South Africa', 'everest-forms'),
1956 'GS' => esc_html__('South Georgia/Sandwich Islands', 'everest-forms'),
1957 'KR' => esc_html__('South Korea', 'everest-forms'),
1958 'SS' => esc_html__('South Sudan', 'everest-forms'),
1959 'ES' => esc_html__('Spain', 'everest-forms'),
1960 'LK' => esc_html__('Sri Lanka', 'everest-forms'),
1961 'SD' => esc_html__('Sudan', 'everest-forms'),
1962 'SR' => esc_html__('Suriname', 'everest-forms'),
1963 'SJ' => esc_html__('Svalbard and Jan Mayen', 'everest-forms'),
1964 'SZ' => esc_html__('Swaziland', 'everest-forms'),
1965 'SE' => esc_html__('Sweden', 'everest-forms'),
1966 'CH' => esc_html__('Switzerland', 'everest-forms'),
1967 'SY' => esc_html__('Syria', 'everest-forms'),
1968 'TW' => esc_html__('Taiwan', 'everest-forms'),
1969 'TJ' => esc_html__('Tajikistan', 'everest-forms'),
1970 'TZ' => esc_html__('Tanzania', 'everest-forms'),
1971 'TH' => esc_html__('Thailand', 'everest-forms'),
1972 'TL' => esc_html__('Timor-Leste', 'everest-forms'),
1973 'TG' => esc_html__('Togo', 'everest-forms'),
1974 'TK' => esc_html__('Tokelau', 'everest-forms'),
1975 'TO' => esc_html__('Tonga', 'everest-forms'),
1976 'TT' => esc_html__('Trinidad and Tobago', 'everest-forms'),
1977 'TN' => esc_html__('Tunisia', 'everest-forms'),
1978 'TR' => esc_html__('Turkey', 'everest-forms'),
1979 'TM' => esc_html__('Turkmenistan', 'everest-forms'),
1980 'TC' => esc_html__('Turks and Caicos Islands', 'everest-forms'),
1981 'TV' => esc_html__('Tuvalu', 'everest-forms'),
1982 'UG' => esc_html__('Uganda', 'everest-forms'),
1983 'UA' => esc_html__('Ukraine', 'everest-forms'),
1984 'AE' => esc_html__('United Arab Emirates', 'everest-forms'),
1985 'GB' => esc_html__('United Kingdom (UK)', 'everest-forms'),
1986 'US' => esc_html__('United States (US)', 'everest-forms'),
1987 'UM' => esc_html__('United States (US) Minor Outlying Islands', 'everest-forms'),
1988 'UY' => esc_html__('Uruguay', 'everest-forms'),
1989 'UZ' => esc_html__('Uzbekistan', 'everest-forms'),
1990 'VU' => esc_html__('Vanuatu', 'everest-forms'),
1991 'VA' => esc_html__('Vatican', 'everest-forms'),
1992 'VE' => esc_html__('Venezuela', 'everest-forms'),
1993 'VN' => esc_html__('Vietnam', 'everest-forms'),
1994 'VG' => esc_html__('Virgin Islands (British)', 'everest-forms'),
1995 'VI' => esc_html__('Virgin Islands (US)', 'everest-forms'),
1996 'WF' => esc_html__('Wallis and Futuna', 'everest-forms'),
1997 'EH' => esc_html__('Western Sahara', 'everest-forms'),
1998 'WS' => esc_html__('Samoa', 'everest-forms'),
1999 'YE' => esc_html__('Yemen', 'everest-forms'),
2000 'ZM' => esc_html__('Zambia', 'everest-forms'),
2001 'ZW' => esc_html__('Zimbabwe', 'everest-forms'),
2002 );
2003
2004 return (array) apply_filters('everest_forms_countries', $countries);
2005 }
2006
2007 /**
2008 * Get U.S. States.
2009 *
2010 * @since 1.7.0
2011 * @return array
2012 */
2013 function evf_get_states()
2014 {
2015 $states = array(
2016 'AF' => array(),
2017 'AL' => array( // Albanian states.
2018 'AL-01' => __('Berat', 'everest-forms'),
2019 'AL-09' => __('Dibër', 'everest-forms'),
2020 'AL-02' => __('Durrës', 'everest-forms'),
2021 'AL-03' => __('Elbasan', 'everest-forms'),
2022 'AL-04' => __('Fier', 'everest-forms'),
2023 'AL-05' => __('Gjirokastër', 'everest-forms'),
2024 'AL-06' => __('Korçë', 'everest-forms'),
2025 'AL-07' => __('Kukës', 'everest-forms'),
2026 'AL-08' => __('Lezhë', 'everest-forms'),
2027 'AL-10' => __('Shkodër', 'everest-forms'),
2028 'AL-11' => __('Tirana', 'everest-forms'),
2029 'AL-12' => __('Vlorë', 'everest-forms'),
2030 ),
2031 'AO' => array( // Angolan states.
2032 'BGO' => __('Bengo', 'everest-forms'),
2033 'BLU' => __('Benguela', 'everest-forms'),
2034 'BIE' => __('Bié', 'everest-forms'),
2035 'CAB' => __('Cabinda', 'everest-forms'),
2036 'CNN' => __('Cunene', 'everest-forms'),
2037 'HUA' => __('Huambo', 'everest-forms'),
2038 'HUI' => __('Huíla', 'everest-forms'),
2039 'CCU' => __('Kuando Kubango', 'everest-forms'),
2040 'CNO' => __('Kwanza-Norte', 'everest-forms'),
2041 'CUS' => __('Kwanza-Sul', 'everest-forms'),
2042 'LUA' => __('Luanda', 'everest-forms'),
2043 'LNO' => __('Lunda-Norte', 'everest-forms'),
2044 'LSU' => __('Lunda-Sul', 'everest-forms'),
2045 'MAL' => __('Malanje', 'everest-forms'),
2046 'MOX' => __('Moxico', 'everest-forms'),
2047 'NAM' => __('Namibe', 'everest-forms'),
2048 'UIG' => __('Uíge', 'everest-forms'),
2049 'ZAI' => __('Zaire', 'everest-forms'),
2050 ),
2051 'AR' => array( // Argentinian provinces.
2052 'C' => __('Ciudad Autónoma de Buenos Aires', 'everest-forms'),
2053 'B' => __('Buenos Aires', 'everest-forms'),
2054 'K' => __('Catamarca', 'everest-forms'),
2055 'H' => __('Chaco', 'everest-forms'),
2056 'U' => __('Chubut', 'everest-forms'),
2057 'X' => __('Córdoba', 'everest-forms'),
2058 'W' => __('Corrientes', 'everest-forms'),
2059 'E' => __('Entre Ríos', 'everest-forms'),
2060 'P' => __('Formosa', 'everest-forms'),
2061 'Y' => __('Jujuy', 'everest-forms'),
2062 'L' => __('La Pampa', 'everest-forms'),
2063 'F' => __('La Rioja', 'everest-forms'),
2064 'M' => __('Mendoza', 'everest-forms'),
2065 'N' => __('Misiones', 'everest-forms'),
2066 'Q' => __('Neuquén', 'everest-forms'),
2067 'R' => __('Río Negro', 'everest-forms'),
2068 'A' => __('Salta', 'everest-forms'),
2069 'J' => __('San Juan', 'everest-forms'),
2070 'D' => __('San Luis', 'everest-forms'),
2071 'Z' => __('Santa Cruz', 'everest-forms'),
2072 'S' => __('Santa Fe', 'everest-forms'),
2073 'G' => __('Santiago del Estero', 'everest-forms'),
2074 'V' => __('Tierra del Fuego', 'everest-forms'),
2075 'T' => __('Tucumán', 'everest-forms'),
2076 ),
2077 'AT' => array(),
2078 'AU' => array( // Australian states.
2079 'ACT' => __('Australian Capital Territory', 'everest-forms'),
2080 'NSW' => __('New South Wales', 'everest-forms'),
2081 'NT' => __('Northern Territory', 'everest-forms'),
2082 'QLD' => __('Queensland', 'everest-forms'),
2083 'SA' => __('South Australia', 'everest-forms'),
2084 'TAS' => __('Tasmania', 'everest-forms'),
2085 'VIC' => __('Victoria', 'everest-forms'),
2086 'WA' => __('Western Australia', 'everest-forms'),
2087 ),
2088 'AX' => array(),
2089 'BD' => array( // Bangladeshi districts.
2090 'BD-05' => __('Bagerhat', 'everest-forms'),
2091 'BD-01' => __('Bandarban', 'everest-forms'),
2092 'BD-02' => __('Barguna', 'everest-forms'),
2093 'BD-06' => __('Barishal', 'everest-forms'),
2094 'BD-07' => __('Bhola', 'everest-forms'),
2095 'BD-03' => __('Bogura', 'everest-forms'),
2096 'BD-04' => __('Brahmanbaria', 'everest-forms'),
2097 'BD-09' => __('Chandpur', 'everest-forms'),
2098 'BD-10' => __('Chattogram', 'everest-forms'),
2099 'BD-12' => __('Chuadanga', 'everest-forms'),
2100 'BD-11' => __("Cox's Bazar", 'everest-forms'),
2101 'BD-08' => __('Cumilla', 'everest-forms'),
2102 'BD-13' => __('Dhaka', 'everest-forms'),
2103 'BD-14' => __('Dinajpur', 'everest-forms'),
2104 'BD-15' => __('Faridpur ', 'everest-forms'),
2105 'BD-16' => __('Feni', 'everest-forms'),
2106 'BD-19' => __('Gaibandha', 'everest-forms'),
2107 'BD-18' => __('Gazipur', 'everest-forms'),
2108 'BD-17' => __('Gopalganj', 'everest-forms'),
2109 'BD-20' => __('Habiganj', 'everest-forms'),
2110 'BD-21' => __('Jamalpur', 'everest-forms'),
2111 'BD-22' => __('Jashore', 'everest-forms'),
2112 'BD-25' => __('Jhalokati', 'everest-forms'),
2113 'BD-23' => __('Jhenaidah', 'everest-forms'),
2114 'BD-24' => __('Joypurhat', 'everest-forms'),
2115 'BD-29' => __('Khagrachhari', 'everest-forms'),
2116 'BD-27' => __('Khulna', 'everest-forms'),
2117 'BD-26' => __('Kishoreganj', 'everest-forms'),
2118 'BD-28' => __('Kurigram', 'everest-forms'),
2119 'BD-30' => __('Kushtia', 'everest-forms'),
2120 'BD-31' => __('Lakshmipur', 'everest-forms'),
2121 'BD-32' => __('Lalmonirhat', 'everest-forms'),
2122 'BD-36' => __('Madaripur', 'everest-forms'),
2123 'BD-37' => __('Magura', 'everest-forms'),
2124 'BD-33' => __('Manikganj ', 'everest-forms'),
2125 'BD-39' => __('Meherpur', 'everest-forms'),
2126 'BD-38' => __('Moulvibazar', 'everest-forms'),
2127 'BD-35' => __('Munshiganj', 'everest-forms'),
2128 'BD-34' => __('Mymensingh', 'everest-forms'),
2129 'BD-48' => __('Naogaon', 'everest-forms'),
2130 'BD-43' => __('Narail', 'everest-forms'),
2131 'BD-40' => __('Narayanganj', 'everest-forms'),
2132 'BD-42' => __('Narsingdi', 'everest-forms'),
2133 'BD-44' => __('Natore', 'everest-forms'),
2134 'BD-45' => __('Nawabganj', 'everest-forms'),
2135 'BD-41' => __('Netrakona', 'everest-forms'),
2136 'BD-46' => __('Nilphamari', 'everest-forms'),
2137 'BD-47' => __('Noakhali', 'everest-forms'),
2138 'BD-49' => __('Pabna', 'everest-forms'),
2139 'BD-52' => __('Panchagarh', 'everest-forms'),
2140 'BD-51' => __('Patuakhali', 'everest-forms'),
2141 'BD-50' => __('Pirojpur', 'everest-forms'),
2142 'BD-53' => __('Rajbari', 'everest-forms'),
2143 'BD-54' => __('Rajshahi', 'everest-forms'),
2144 'BD-56' => __('Rangamati', 'everest-forms'),
2145 'BD-55' => __('Rangpur', 'everest-forms'),
2146 'BD-58' => __('Satkhira', 'everest-forms'),
2147 'BD-62' => __('Shariatpur', 'everest-forms'),
2148 'BD-57' => __('Sherpur', 'everest-forms'),
2149 'BD-59' => __('Sirajganj', 'everest-forms'),
2150 'BD-61' => __('Sunamganj', 'everest-forms'),
2151 'BD-60' => __('Sylhet', 'everest-forms'),
2152 'BD-63' => __('Tangail', 'everest-forms'),
2153 'BD-64' => __('Thakurgaon', 'everest-forms'),
2154 ),
2155 'BE' => array(),
2156 'BG' => array( // Bulgarian states.
2157 'BG-01' => __('Blagoevgrad', 'everest-forms'),
2158 'BG-02' => __('Burgas', 'everest-forms'),
2159 'BG-08' => __('Dobrich', 'everest-forms'),
2160 'BG-07' => __('Gabrovo', 'everest-forms'),
2161 'BG-26' => __('Haskovo', 'everest-forms'),
2162 'BG-09' => __('Kardzhali', 'everest-forms'),
2163 'BG-10' => __('Kyustendil', 'everest-forms'),
2164 'BG-11' => __('Lovech', 'everest-forms'),
2165 'BG-12' => __('Montana', 'everest-forms'),
2166 'BG-13' => __('Pazardzhik', 'everest-forms'),
2167 'BG-14' => __('Pernik', 'everest-forms'),
2168 'BG-15' => __('Pleven', 'everest-forms'),
2169 'BG-16' => __('Plovdiv', 'everest-forms'),
2170 'BG-17' => __('Razgrad', 'everest-forms'),
2171 'BG-18' => __('Ruse', 'everest-forms'),
2172 'BG-27' => __('Shumen', 'everest-forms'),
2173 'BG-19' => __('Silistra', 'everest-forms'),
2174 'BG-20' => __('Sliven', 'everest-forms'),
2175 'BG-21' => __('Smolyan', 'everest-forms'),
2176 'BG-23' => __('Sofia', 'everest-forms'),
2177 'BG-22' => __('Sofia-Grad', 'everest-forms'),
2178 'BG-24' => __('Stara Zagora', 'everest-forms'),
2179 'BG-25' => __('Targovishte', 'everest-forms'),
2180 'BG-03' => __('Varna', 'everest-forms'),
2181 'BG-04' => __('Veliko Tarnovo', 'everest-forms'),
2182 'BG-05' => __('Vidin', 'everest-forms'),
2183 'BG-06' => __('Vratsa', 'everest-forms'),
2184 'BG-28' => __('Yambol', 'everest-forms'),
2185 ),
2186 'BH' => array(),
2187 'BI' => array(),
2188 'BJ' => array( // Beninese states.
2189 'AL' => __('Alibori', 'everest-forms'),
2190 'AK' => __('Atakora', 'everest-forms'),
2191 'AQ' => __('Atlantique', 'everest-forms'),
2192 'BO' => __('Borgou', 'everest-forms'),
2193 'CO' => __('Collines', 'everest-forms'),
2194 'KO' => __('Kouffo', 'everest-forms'),
2195 'DO' => __('Donga', 'everest-forms'),
2196 'LI' => __('Littoral', 'everest-forms'),
2197 'MO' => __('Mono', 'everest-forms'),
2198 'OU' => __('Ouémé', 'everest-forms'),
2199 'PL' => __('Plateau', 'everest-forms'),
2200 'ZO' => __('Zou', 'everest-forms'),
2201 ),
2202 'BO' => array( // Bolivian states.
2203 'BO-B' => __('Beni', 'everest-forms'),
2204 'BO-H' => __('Chuquisaca', 'everest-forms'),
2205 'BO-C' => __('Cochabamba', 'everest-forms'),
2206 'BO-L' => __('La Paz', 'everest-forms'),
2207 'BO-O' => __('Oruro', 'everest-forms'),
2208 'BO-N' => __('Pando', 'everest-forms'),
2209 'BO-P' => __('Potosí', 'everest-forms'),
2210 'BO-S' => __('Santa Cruz', 'everest-forms'),
2211 'BO-T' => __('Tarija', 'everest-forms'),
2212 ),
2213 'BR' => array( // Brazilian states.
2214 'AC' => __('Acre', 'everest-forms'),
2215 'AL' => __('Alagoas', 'everest-forms'),
2216 'AP' => __('Amapá', 'everest-forms'),
2217 'AM' => __('Amazonas', 'everest-forms'),
2218 'BA' => __('Bahia', 'everest-forms'),
2219 'CE' => __('Ceará', 'everest-forms'),
2220 'DF' => __('Distrito Federal', 'everest-forms'),
2221 'ES' => __('Espírito Santo', 'everest-forms'),
2222 'GO' => __('Goiás', 'everest-forms'),
2223 'MA' => __('Maranhão', 'everest-forms'),
2224 'MT' => __('Mato Grosso', 'everest-forms'),
2225 'MS' => __('Mato Grosso do Sul', 'everest-forms'),
2226 'MG' => __('Minas Gerais', 'everest-forms'),
2227 'PA' => __('Pará', 'everest-forms'),
2228 'PB' => __('Paraíba', 'everest-forms'),
2229 'PR' => __('Paraná', 'everest-forms'),
2230 'PE' => __('Pernambuco', 'everest-forms'),
2231 'PI' => __('Piauí', 'everest-forms'),
2232 'RJ' => __('Rio de Janeiro', 'everest-forms'),
2233 'RN' => __('Rio Grande do Norte', 'everest-forms'),
2234 'RS' => __('Rio Grande do Sul', 'everest-forms'),
2235 'RO' => __('Rondônia', 'everest-forms'),
2236 'RR' => __('Roraima', 'everest-forms'),
2237 'SC' => __('Santa Catarina', 'everest-forms'),
2238 'SP' => __('São Paulo', 'everest-forms'),
2239 'SE' => __('Sergipe', 'everest-forms'),
2240 'TO' => __('Tocantins', 'everest-forms'),
2241 ),
2242 'CA' => array( // Canadian states.
2243 'AB' => __('Alberta', 'everest-forms'),
2244 'BC' => __('British Columbia', 'everest-forms'),
2245 'MB' => __('Manitoba', 'everest-forms'),
2246 'NB' => __('New Brunswick', 'everest-forms'),
2247 'NL' => __('Newfoundland and Labrador', 'everest-forms'),
2248 'NT' => __('Northwest Territories', 'everest-forms'),
2249 'NS' => __('Nova Scotia', 'everest-forms'),
2250 'NU' => __('Nunavut', 'everest-forms'),
2251 'ON' => __('Ontario', 'everest-forms'),
2252 'PE' => __('Prince Edward Island', 'everest-forms'),
2253 'QC' => __('Quebec', 'everest-forms'),
2254 'SK' => __('Saskatchewan', 'everest-forms'),
2255 'YT' => __('Yukon Territory', 'everest-forms'),
2256 ),
2257 'CH' => array( // Swiss cantons.
2258 'AG' => __('Aargau', 'everest-forms'),
2259 'AR' => __('Appenzell Ausserrhoden', 'everest-forms'),
2260 'AI' => __('Appenzell Innerrhoden', 'everest-forms'),
2261 'BL' => __('Basel-Landschaft', 'everest-forms'),
2262 'BS' => __('Basel-Stadt', 'everest-forms'),
2263 'BE' => __('Bern', 'everest-forms'),
2264 'FR' => __('Fribourg', 'everest-forms'),
2265 'GE' => __('Geneva', 'everest-forms'),
2266 'GL' => __('Glarus', 'everest-forms'),
2267 'GR' => __('Graubünden', 'everest-forms'),
2268 'JU' => __('Jura', 'everest-forms'),
2269 'LU' => __('Luzern', 'everest-forms'),
2270 'NE' => __('Neuchâtel', 'everest-forms'),
2271 'NW' => __('Nidwalden', 'everest-forms'),
2272 'OW' => __('Obwalden', 'everest-forms'),
2273 'SH' => __('Schaffhausen', 'everest-forms'),
2274 'SZ' => __('Schwyz', 'everest-forms'),
2275 'SO' => __('Solothurn', 'everest-forms'),
2276 'SG' => __('St. Gallen', 'everest-forms'),
2277 'TG' => __('Thurgau', 'everest-forms'),
2278 'TI' => __('Ticino', 'everest-forms'),
2279 'UR' => __('Uri', 'everest-forms'),
2280 'VS' => __('Valais', 'everest-forms'),
2281 'VD' => __('Vaud', 'everest-forms'),
2282 'ZG' => __('Zug', 'everest-forms'),
2283 'ZH' => __('Zürich', 'everest-forms'),
2284 ),
2285 'CL' => array( // Chilean states.
2286 'CL-AI' => __('Aisén del General Carlos Ibañez del Campo', 'everest-forms'),
2287 'CL-AN' => __('Antofagasta', 'everest-forms'),
2288 'CL-AP' => __('Arica y Parinacota', 'everest-forms'),
2289 'CL-AR' => __('La Araucanía', 'everest-forms'),
2290 'CL-AT' => __('Atacama', 'everest-forms'),
2291 'CL-BI' => __('Biobío', 'everest-forms'),
2292 'CL-CO' => __('Coquimbo', 'everest-forms'),
2293 'CL-LI' => __('Libertador General Bernardo O\'Higgins', 'everest-forms'),
2294 'CL-LL' => __('Los Lagos', 'everest-forms'),
2295 'CL-LR' => __('Los Ríos', 'everest-forms'),
2296 'CL-MA' => __('Magallanes', 'everest-forms'),
2297 'CL-ML' => __('Maule', 'everest-forms'),
2298 'CL-NB' => __('Ñuble', 'everest-forms'),
2299 'CL-RM' => __('Región Metropolitana de Santiago', 'everest-forms'),
2300 'CL-TA' => __('Tarapacá', 'everest-forms'),
2301 'CL-VS' => __('Valparaíso', 'everest-forms'),
2302 ),
2303 'CN' => array( // Chinese states.
2304 'CN1' => __('Yunnan / 云南', 'everest-forms'),
2305 'CN2' => __('Beijing / 北京', 'everest-forms'),
2306 'CN3' => __('Tianjin / 天津', 'everest-forms'),
2307 'CN4' => __('Hebei / 河北', 'everest-forms'),
2308 'CN5' => __('Shanxi / 山西', 'everest-forms'),
2309 'CN6' => __('Inner Mongolia / �
2310 �蒙古', 'everest-forms'),
2311 'CN7' => __('Liaoning / 辽宁', 'everest-forms'),
2312 'CN8' => __('Jilin / 吉林', 'everest-forms'),
2313 'CN9' => __('Heilongjiang / 黑龙江', 'everest-forms'),
2314 'CN10' => __('Shanghai / 上海', 'everest-forms'),
2315 'CN11' => __('Jiangsu / 江苏', 'everest-forms'),
2316 'CN12' => __('Zhejiang / 浙江', 'everest-forms'),
2317 'CN13' => __('Anhui / 安徽', 'everest-forms'),
2318 'CN14' => __('Fujian / 福建', 'everest-forms'),
2319 'CN15' => __('Jiangxi / 江西', 'everest-forms'),
2320 'CN16' => __('Shandong / 山东', 'everest-forms'),
2321 'CN17' => __('Henan / 河南', 'everest-forms'),
2322 'CN18' => __('Hubei / 湖北', 'everest-forms'),
2323 'CN19' => __('Hunan / 湖南', 'everest-forms'),
2324 'CN20' => __('Guangdong / 广东', 'everest-forms'),
2325 'CN21' => __('Guangxi Zhuang / 广西壮族', 'everest-forms'),
2326 'CN22' => __('Hainan / 海南', 'everest-forms'),
2327 'CN23' => __('Chongqing / 重庆', 'everest-forms'),
2328 'CN24' => __('Sichuan / 四川', 'everest-forms'),
2329 'CN25' => __('Guizhou / 贵州', 'everest-forms'),
2330 'CN26' => __('Shaanxi / 陕西', 'everest-forms'),
2331 'CN27' => __('Gansu / 甘肃', 'everest-forms'),
2332 'CN28' => __('Qinghai / 青海', 'everest-forms'),
2333 'CN29' => __('Ningxia Hui / 宁夏', 'everest-forms'),
2334 'CN30' => __('Macao / 澳门', 'everest-forms'),
2335 'CN31' => __('Tibet / 西藏', 'everest-forms'),
2336 'CN32' => __('Xinjiang / 新疆', 'everest-forms'),
2337 ),
2338 'CO' => array( // Colombian states.
2339 'CO-AMA' => __('Amazonas', 'everest-forms'),
2340 'CO-ANT' => __('Antioquia', 'everest-forms'),
2341 'CO-ARA' => __('Arauca', 'everest-forms'),
2342 'CO-ATL' => __('Atlántico', 'everest-forms'),
2343 'CO-BOL' => __('Bolívar', 'everest-forms'),
2344 'CO-BOY' => __('Boyacá', 'everest-forms'),
2345 'CO-CAL' => __('Caldas', 'everest-forms'),
2346 'CO-CAQ' => __('Caquetá', 'everest-forms'),
2347 'CO-CAS' => __('Casanare', 'everest-forms'),
2348 'CO-CAU' => __('Cauca', 'everest-forms'),
2349 'CO-CES' => __('Cesar', 'everest-forms'),
2350 'CO-CHO' => __('Chocó', 'everest-forms'),
2351 'CO-COR' => __('Córdoba', 'everest-forms'),
2352 'CO-CUN' => __('Cundinamarca', 'everest-forms'),
2353 'CO-DC' => __('Capital District', 'everest-forms'),
2354 'CO-GUA' => __('Guainía', 'everest-forms'),
2355 'CO-GUV' => __('Guaviare', 'everest-forms'),
2356 'CO-HUI' => __('Huila', 'everest-forms'),
2357 'CO-LAG' => __('La Guajira', 'everest-forms'),
2358 'CO-MAG' => __('Magdalena', 'everest-forms'),
2359 'CO-MET' => __('Meta', 'everest-forms'),
2360 'CO-NAR' => __('Nariño', 'everest-forms'),
2361 'CO-NSA' => __('Norte de Santander', 'everest-forms'),
2362 'CO-PUT' => __('Putumayo', 'everest-forms'),
2363 'CO-QUI' => __('Quindío', 'everest-forms'),
2364 'CO-RIS' => __('Risaralda', 'everest-forms'),
2365 'CO-SAN' => __('Santander', 'everest-forms'),
2366 'CO-SAP' => __('San Andrés & Providencia', 'everest-forms'),
2367 'CO-SUC' => __('Sucre', 'everest-forms'),
2368 'CO-TOL' => __('Tolima', 'everest-forms'),
2369 'CO-VAC' => __('Valle del Cauca', 'everest-forms'),
2370 'CO-VAU' => __('Vaupés', 'everest-forms'),
2371 'CO-VID' => __('Vichada', 'everest-forms'),
2372 ),
2373 'CR' => array( // Costa Rican states.
2374 'CR-A' => __('Alajuela', 'everest-forms'),
2375 'CR-C' => __('Cartago', 'everest-forms'),
2376 'CR-G' => __('Guanacaste', 'everest-forms'),
2377 'CR-H' => __('Heredia', 'everest-forms'),
2378 'CR-L' => __('Limón', 'everest-forms'),
2379 'CR-P' => __('Puntarenas', 'everest-forms'),
2380 'CR-SJ' => __('San José', 'everest-forms'),
2381 ),
2382 'CZ' => array(),
2383 'DE' => array( // German states.
2384 'DE-BW' => __('Baden-Württemberg', 'everest-forms'),
2385 'DE-BY' => __('Bavaria', 'everest-forms'),
2386 'DE-BE' => __('Berlin', 'everest-forms'),
2387 'DE-BB' => __('Brandenburg', 'everest-forms'),
2388 'DE-HB' => __('Bremen', 'everest-forms'),
2389 'DE-HH' => __('Hamburg', 'everest-forms'),
2390 'DE-HE' => __('Hesse', 'everest-forms'),
2391 'DE-MV' => __('Mecklenburg-Vorpommern', 'everest-forms'),
2392 'DE-NI' => __('Lower Saxony', 'everest-forms'),
2393 'DE-NW' => __('North Rhine-Westphalia', 'everest-forms'),
2394 'DE-RP' => __('Rhineland-Palatinate', 'everest-forms'),
2395 'DE-SL' => __('Saarland', 'everest-forms'),
2396 'DE-SN' => __('Saxony', 'everest-forms'),
2397 'DE-ST' => __('Saxony-Anhalt', 'everest-forms'),
2398 'DE-SH' => __('Schleswig-Holstein', 'everest-forms'),
2399 'DE-TH' => __('Thuringia', 'everest-forms'),
2400 ),
2401 'DK' => array(),
2402 'DO' => array( // Dominican states.
2403 'DO-01' => __('Distrito Nacional', 'everest-forms'),
2404 'DO-02' => __('Azua', 'everest-forms'),
2405 'DO-03' => __('Baoruco', 'everest-forms'),
2406 'DO-04' => __('Barahona', 'everest-forms'),
2407 'DO-33' => __('Cibao Nordeste', 'everest-forms'),
2408 'DO-34' => __('Cibao Noroeste', 'everest-forms'),
2409 'DO-35' => __('Cibao Norte', 'everest-forms'),
2410 'DO-36' => __('Cibao Sur', 'everest-forms'),
2411 'DO-05' => __('Dajabón', 'everest-forms'),
2412 'DO-06' => __('Duarte', 'everest-forms'),
2413 'DO-08' => __('El Seibo', 'everest-forms'),
2414 'DO-37' => __('El Valle', 'everest-forms'),
2415 'DO-07' => __('Elías Piña', 'everest-forms'),
2416 'DO-38' => __('Enriquillo', 'everest-forms'),
2417 'DO-09' => __('Espaillat', 'everest-forms'),
2418 'DO-30' => __('Hato Mayor', 'everest-forms'),
2419 'DO-19' => __('Hermanas Mirabal', 'everest-forms'),
2420 'DO-39' => __('Higüamo', 'everest-forms'),
2421 'DO-10' => __('Independencia', 'everest-forms'),
2422 'DO-11' => __('La Altagracia', 'everest-forms'),
2423 'DO-12' => __('La Romana', 'everest-forms'),
2424 'DO-13' => __('La Vega', 'everest-forms'),
2425 'DO-14' => __('María Trinidad Sánchez', 'everest-forms'),
2426 'DO-28' => __('Monseñor Nouel', 'everest-forms'),
2427 'DO-15' => __('Monte Cristi', 'everest-forms'),
2428 'DO-29' => __('Monte Plata', 'everest-forms'),
2429 'DO-40' => __('Ozama', 'everest-forms'),
2430 'DO-16' => __('Pedernales', 'everest-forms'),
2431 'DO-17' => __('Peravia', 'everest-forms'),
2432 'DO-18' => __('Puerto Plata', 'everest-forms'),
2433 'DO-20' => __('Samaná', 'everest-forms'),
2434 'DO-21' => __('San Cristóbal', 'everest-forms'),
2435 'DO-31' => __('San José de Ocoa', 'everest-forms'),
2436 'DO-22' => __('San Juan', 'everest-forms'),
2437 'DO-23' => __('San Pedro de Macorís', 'everest-forms'),
2438 'DO-24' => __('Sánchez Ramírez', 'everest-forms'),
2439 'DO-25' => __('Santiago', 'everest-forms'),
2440 'DO-26' => __('Santiago Rodríguez', 'everest-forms'),
2441 'DO-32' => __('Santo Domingo', 'everest-forms'),
2442 'DO-41' => __('Valdesia', 'everest-forms'),
2443 'DO-27' => __('Valverde', 'everest-forms'),
2444 'DO-42' => __('Yuma', 'everest-forms'),
2445 ),
2446 'DZ' => array( // Algerian states.
2447 'DZ-01' => __('Adrar', 'everest-forms'),
2448 'DZ-02' => __('Chlef', 'everest-forms'),
2449 'DZ-03' => __('Laghouat', 'everest-forms'),
2450 'DZ-04' => __('Oum El Bouaghi', 'everest-forms'),
2451 'DZ-05' => __('Batna', 'everest-forms'),
2452 'DZ-06' => __('Béjaïa', 'everest-forms'),
2453 'DZ-07' => __('Biskra', 'everest-forms'),
2454 'DZ-08' => __('Béchar', 'everest-forms'),
2455 'DZ-09' => __('Blida', 'everest-forms'),
2456 'DZ-10' => __('Bouira', 'everest-forms'),
2457 'DZ-11' => __('Tamanghasset', 'everest-forms'),
2458 'DZ-12' => __('Tébessa', 'everest-forms'),
2459 'DZ-13' => __('Tlemcen', 'everest-forms'),
2460 'DZ-14' => __('Tiaret', 'everest-forms'),
2461 'DZ-15' => __('Tizi Ouzou', 'everest-forms'),
2462 'DZ-16' => __('Algiers', 'everest-forms'),
2463 'DZ-17' => __('Djelfa', 'everest-forms'),
2464 'DZ-18' => __('Jijel', 'everest-forms'),
2465 'DZ-19' => __('Sétif', 'everest-forms'),
2466 'DZ-20' => __('Saïda', 'everest-forms'),
2467 'DZ-21' => __('Skikda', 'everest-forms'),
2468 'DZ-22' => __('Sidi Bel Abbès', 'everest-forms'),
2469 'DZ-23' => __('Annaba', 'everest-forms'),
2470 'DZ-24' => __('Guelma', 'everest-forms'),
2471 'DZ-25' => __('Constantine', 'everest-forms'),
2472 'DZ-26' => __('Médéa', 'everest-forms'),
2473 'DZ-27' => __('Mostaganem', 'everest-forms'),
2474 'DZ-28' => __('M’Sila', 'everest-forms'),
2475 'DZ-29' => __('Mascara', 'everest-forms'),
2476 'DZ-30' => __('Ouargla', 'everest-forms'),
2477 'DZ-31' => __('Oran', 'everest-forms'),
2478 'DZ-32' => __('El Bayadh', 'everest-forms'),
2479 'DZ-33' => __('Illizi', 'everest-forms'),
2480 'DZ-34' => __('Bordj Bou Arréridj', 'everest-forms'),
2481 'DZ-35' => __('Boumerdès', 'everest-forms'),
2482 'DZ-36' => __('El Tarf', 'everest-forms'),
2483 'DZ-37' => __('Tindouf', 'everest-forms'),
2484 'DZ-38' => __('Tissemsilt', 'everest-forms'),
2485 'DZ-39' => __('El Oued', 'everest-forms'),
2486 'DZ-40' => __('Khenchela', 'everest-forms'),
2487 'DZ-41' => __('Souk Ahras', 'everest-forms'),
2488 'DZ-42' => __('Tipasa', 'everest-forms'),
2489 'DZ-43' => __('Mila', 'everest-forms'),
2490 'DZ-44' => __('Aïn Defla', 'everest-forms'),
2491 'DZ-45' => __('Naama', 'everest-forms'),
2492 'DZ-46' => __('Aïn Témouchent', 'everest-forms'),
2493 'DZ-47' => __('Ghardaïa', 'everest-forms'),
2494 'DZ-48' => __('Relizane', 'everest-forms'),
2495 ),
2496 'EE' => array(),
2497 'EC' => array( // Ecuadorian states.
2498 'EC-A' => __('Azuay', 'everest-forms'),
2499 'EC-B' => __('Bolívar', 'everest-forms'),
2500 'EC-F' => __('Cañar', 'everest-forms'),
2501 'EC-C' => __('Carchi', 'everest-forms'),
2502 'EC-H' => __('Chimborazo', 'everest-forms'),
2503 'EC-X' => __('Cotopaxi', 'everest-forms'),
2504 'EC-O' => __('El Oro', 'everest-forms'),
2505 'EC-E' => __('Esmeraldas', 'everest-forms'),
2506 'EC-W' => __('Galápagos', 'everest-forms'),
2507 'EC-G' => __('Guayas', 'everest-forms'),
2508 'EC-I' => __('Imbabura', 'everest-forms'),
2509 'EC-L' => __('Loja', 'everest-forms'),
2510 'EC-R' => __('Los Ríos', 'everest-forms'),
2511 'EC-M' => __('Manabí', 'everest-forms'),
2512 'EC-S' => __('Morona-Santiago', 'everest-forms'),
2513 'EC-N' => __('Napo', 'everest-forms'),
2514 'EC-D' => __('Orellana', 'everest-forms'),
2515 'EC-Y' => __('Pastaza', 'everest-forms'),
2516 'EC-P' => __('Pichincha', 'everest-forms'),
2517 'EC-SE' => __('Santa Elena', 'everest-forms'),
2518 'EC-SD' => __('Santo Domingo de los Tsáchilas', 'everest-forms'),
2519 'EC-U' => __('Sucumbíos', 'everest-forms'),
2520 'EC-T' => __('Tungurahua', 'everest-forms'),
2521 'EC-Z' => __('Zamora-Chinchipe', 'everest-forms'),
2522 ),
2523 'EG' => array( // Egyptian states.
2524 'EGALX' => __('Alexandria', 'everest-forms'),
2525 'EGASN' => __('Aswan', 'everest-forms'),
2526 'EGAST' => __('Asyut', 'everest-forms'),
2527 'EGBA' => __('Red Sea', 'everest-forms'),
2528 'EGBH' => __('Beheira', 'everest-forms'),
2529 'EGBNS' => __('Beni Suef', 'everest-forms'),
2530 'EGC' => __('Cairo', 'everest-forms'),
2531 'EGDK' => __('Dakahlia', 'everest-forms'),
2532 'EGDT' => __('Damietta', 'everest-forms'),
2533 'EGFYM' => __('Faiyum', 'everest-forms'),
2534 'EGGH' => __('Gharbia', 'everest-forms'),
2535 'EGGZ' => __('Giza', 'everest-forms'),
2536 'EGIS' => __('Ismailia', 'everest-forms'),
2537 'EGJS' => __('South Sinai', 'everest-forms'),
2538 'EGKB' => __('Qalyubia', 'everest-forms'),
2539 'EGKFS' => __('Kafr el-Sheikh', 'everest-forms'),
2540 'EGKN' => __('Qena', 'everest-forms'),
2541 'EGLX' => __('Luxor', 'everest-forms'),
2542 'EGMN' => __('Minya', 'everest-forms'),
2543 'EGMNF' => __('Monufia', 'everest-forms'),
2544 'EGMT' => __('Matrouh', 'everest-forms'),
2545 'EGPTS' => __('Port Said', 'everest-forms'),
2546 'EGSHG' => __('Sohag', 'everest-forms'),
2547 'EGSHR' => __('Al Sharqia', 'everest-forms'),
2548 'EGSIN' => __('North Sinai', 'everest-forms'),
2549 'EGSUZ' => __('Suez', 'everest-forms'),
2550 'EGWAD' => __('New Valley', 'everest-forms'),
2551 ),
2552 'ES' => array( // Spanish states.
2553 'C' => __('A Coruña', 'everest-forms'),
2554 'VI' => __('Araba/Álava', 'everest-forms'),
2555 'AB' => __('Albacete', 'everest-forms'),
2556 'A' => __('Alicante', 'everest-forms'),
2557 'AL' => __('Almería', 'everest-forms'),
2558 'O' => __('Asturias', 'everest-forms'),
2559 'AV' => __('Ávila', 'everest-forms'),
2560 'BA' => __('Badajoz', 'everest-forms'),
2561 'PM' => __('Baleares', 'everest-forms'),
2562 'B' => __('Barcelona', 'everest-forms'),
2563 'BU' => __('Burgos', 'everest-forms'),
2564 'CC' => __('Cáceres', 'everest-forms'),
2565 'CA' => __('Cádiz', 'everest-forms'),
2566 'S' => __('Cantabria', 'everest-forms'),
2567 'CS' => __('Castellón', 'everest-forms'),
2568 'CE' => __('Ceuta', 'everest-forms'),
2569 'CR' => __('Ciudad Real', 'everest-forms'),
2570 'CO' => __('Córdoba', 'everest-forms'),
2571 'CU' => __('Cuenca', 'everest-forms'),
2572 'GI' => __('Girona', 'everest-forms'),
2573 'GR' => __('Granada', 'everest-forms'),
2574 'GU' => __('Guadalajara', 'everest-forms'),
2575 'SS' => __('Gipuzkoa', 'everest-forms'),
2576 'H' => __('Huelva', 'everest-forms'),
2577 'HU' => __('Huesca', 'everest-forms'),
2578 'J' => __('Jaén', 'everest-forms'),
2579 'LO' => __('La Rioja', 'everest-forms'),
2580 'GC' => __('Las Palmas', 'everest-forms'),
2581 'LE' => __('León', 'everest-forms'),
2582 'L' => __('Lleida', 'everest-forms'),
2583 'LU' => __('Lugo', 'everest-forms'),
2584 'M' => __('Madrid', 'everest-forms'),
2585 'MA' => __('Málaga', 'everest-forms'),
2586 'ML' => __('Melilla', 'everest-forms'),
2587 'MU' => __('Murcia', 'everest-forms'),
2588 'NA' => __('Navarra', 'everest-forms'),
2589 'OR' => __('Ourense', 'everest-forms'),
2590 'P' => __('Palencia', 'everest-forms'),
2591 'PO' => __('Pontevedra', 'everest-forms'),
2592 'SA' => __('Salamanca', 'everest-forms'),
2593 'TF' => __('Santa Cruz de Tenerife', 'everest-forms'),
2594 'SG' => __('Segovia', 'everest-forms'),
2595 'SE' => __('Sevilla', 'everest-forms'),
2596 'SO' => __('Soria', 'everest-forms'),
2597 'T' => __('Tarragona', 'everest-forms'),
2598 'TE' => __('Teruel', 'everest-forms'),
2599 'TO' => __('Toledo', 'everest-forms'),
2600 'V' => __('Valencia', 'everest-forms'),
2601 'VA' => __('Valladolid', 'everest-forms'),
2602 'BI' => __('Biscay', 'everest-forms'),
2603 'ZA' => __('Zamora', 'everest-forms'),
2604 'Z' => __('Zaragoza', 'everest-forms'),
2605 ),
2606 'FI' => array(),
2607 'FR' => array(),
2608 'GF' => array(),
2609 'GH' => array( // Ghanaian regions.
2610 'AF' => __('Ahafo', 'everest-forms'),
2611 'AH' => __('Ashanti', 'everest-forms'),
2612 'BA' => __('Brong-Ahafo', 'everest-forms'),
2613 'BO' => __('Bono', 'everest-forms'),
2614 'BE' => __('Bono East', 'everest-forms'),
2615 'CP' => __('Central', 'everest-forms'),
2616 'EP' => __('Eastern', 'everest-forms'),
2617 'AA' => __('Greater Accra', 'everest-forms'),
2618 'NE' => __('North East', 'everest-forms'),
2619 'NP' => __('Northern', 'everest-forms'),
2620 'OT' => __('Oti', 'everest-forms'),
2621 'SV' => __('Savannah', 'everest-forms'),
2622 'UE' => __('Upper East', 'everest-forms'),
2623 'UW' => __('Upper West', 'everest-forms'),
2624 'TV' => __('Volta', 'everest-forms'),
2625 'WP' => __('Western', 'everest-forms'),
2626 'WN' => __('Western North', 'everest-forms'),
2627 ),
2628 'GP' => array(),
2629 'GR' => array( // Greek regions.
2630 'I' => __('Attica', 'everest-forms'),
2631 'A' => __('East Macedonia and Thrace', 'everest-forms'),
2632 'B' => __('Central Macedonia', 'everest-forms'),
2633 'C' => __('West Macedonia', 'everest-forms'),
2634 'D' => __('Epirus', 'everest-forms'),
2635 'E' => __('Thessaly', 'everest-forms'),
2636 'F' => __('Ionian Islands', 'everest-forms'),
2637 'G' => __('West Greece', 'everest-forms'),
2638 'H' => __('Central Greece', 'everest-forms'),
2639 'J' => __('Peloponnese', 'everest-forms'),
2640 'K' => __('North Aegean', 'everest-forms'),
2641 'L' => __('South Aegean', 'everest-forms'),
2642 'M' => __('Crete', 'everest-forms'),
2643 ),
2644 'GT' => array( // Guatemalan states.
2645 'GT-AV' => __('Alta Verapaz', 'everest-forms'),
2646 'GT-BV' => __('Baja Verapaz', 'everest-forms'),
2647 'GT-CM' => __('Chimaltenango', 'everest-forms'),
2648 'GT-CQ' => __('Chiquimula', 'everest-forms'),
2649 'GT-PR' => __('El Progreso', 'everest-forms'),
2650 'GT-ES' => __('Escuintla', 'everest-forms'),
2651 'GT-GU' => __('Guatemala', 'everest-forms'),
2652 'GT-HU' => __('Huehuetenango', 'everest-forms'),
2653 'GT-IZ' => __('Izabal', 'everest-forms'),
2654 'GT-JA' => __('Jalapa', 'everest-forms'),
2655 'GT-JU' => __('Jutiapa', 'everest-forms'),
2656 'GT-PE' => __('Petén', 'everest-forms'),
2657 'GT-QZ' => __('Quetzaltenango', 'everest-forms'),
2658 'GT-QC' => __('Quiché', 'everest-forms'),
2659 'GT-RE' => __('Retalhuleu', 'everest-forms'),
2660 'GT-SA' => __('Sacatepéquez', 'everest-forms'),
2661 'GT-SM' => __('San Marcos', 'everest-forms'),
2662 'GT-SR' => __('Santa Rosa', 'everest-forms'),
2663 'GT-SO' => __('Sololá', 'everest-forms'),
2664 'GT-SU' => __('Suchitepéquez', 'everest-forms'),
2665 'GT-TO' => __('Totonicapán', 'everest-forms'),
2666 'GT-ZA' => __('Zacapa', 'everest-forms'),
2667 ),
2668 'HK' => array( // Hong Kong states.
2669 'HONG KONG' => __('Hong Kong Island', 'everest-forms'),
2670 'KOWLOON' => __('Kowloon', 'everest-forms'),
2671 'NEW TERRITORIES' => __('New Territories', 'everest-forms'),
2672 ),
2673 'HN' => array( // Honduran states.
2674 'HN-AT' => __('Atlántida', 'everest-forms'),
2675 'HN-IB' => __('Bay Islands', 'everest-forms'),
2676 'HN-CH' => __('Choluteca', 'everest-forms'),
2677 'HN-CL' => __('Colón', 'everest-forms'),
2678 'HN-CM' => __('Comayagua', 'everest-forms'),
2679 'HN-CP' => __('Copán', 'everest-forms'),
2680 'HN-CR' => __('Cortés', 'everest-forms'),
2681 'HN-EP' => __('El Paraíso', 'everest-forms'),
2682 'HN-FM' => __('Francisco Morazán', 'everest-forms'),
2683 'HN-GD' => __('Gracias a Dios', 'everest-forms'),
2684 'HN-IN' => __('Intibucá', 'everest-forms'),
2685 'HN-LE' => __('Lempira', 'everest-forms'),
2686 'HN-LP' => __('La Paz', 'everest-forms'),
2687 'HN-OC' => __('Ocotepeque', 'everest-forms'),
2688 'HN-OL' => __('Olancho', 'everest-forms'),
2689 'HN-SB' => __('Santa Bárbara', 'everest-forms'),
2690 'HN-VA' => __('Valle', 'everest-forms'),
2691 'HN-YO' => __('Yoro', 'everest-forms'),
2692 ),
2693 'HU' => array( // Hungarian states.
2694 'BK' => __('Bács-Kiskun', 'everest-forms'),
2695 'BE' => __('Békés', 'everest-forms'),
2696 'BA' => __('Baranya', 'everest-forms'),
2697 'BZ' => __('Borsod-Abaúj-Zemplén', 'everest-forms'),
2698 'BU' => __('Budapest', 'everest-forms'),
2699 'CS' => __('Csongrád-Csanád', 'everest-forms'),
2700 'FE' => __('Fejér', 'everest-forms'),
2701 'GS' => __('Győr-Moson-Sopron', 'everest-forms'),
2702 'HB' => __('Hajdú-Bihar', 'everest-forms'),
2703 'HE' => __('Heves', 'everest-forms'),
2704 'JN' => __('Jász-Nagykun-Szolnok', 'everest-forms'),
2705 'KE' => __('Komárom-Esztergom', 'everest-forms'),
2706 'NO' => __('Nógrád', 'everest-forms'),
2707 'PE' => __('Pest', 'everest-forms'),
2708 'SO' => __('Somogy', 'everest-forms'),
2709 'SZ' => __('Szabolcs-Szatmár-Bereg', 'everest-forms'),
2710 'TO' => __('Tolna', 'everest-forms'),
2711 'VA' => __('Vas', 'everest-forms'),
2712 'VE' => __('Veszprém', 'everest-forms'),
2713 'ZA' => __('Zala', 'everest-forms'),
2714 ),
2715 'ID' => array( // Indonesian provinces.
2716 'AC' => __('Daerah Istimewa Aceh', 'everest-forms'),
2717 'SU' => __('Sumatera Utara', 'everest-forms'),
2718 'SB' => __('Sumatera Barat', 'everest-forms'),
2719 'RI' => __('Riau', 'everest-forms'),
2720 'KR' => __('Kepulauan Riau', 'everest-forms'),
2721 'JA' => __('Jambi', 'everest-forms'),
2722 'SS' => __('Sumatera Selatan', 'everest-forms'),
2723 'BB' => __('Bangka Belitung', 'everest-forms'),
2724 'BE' => __('Bengkulu', 'everest-forms'),
2725 'LA' => __('Lampung', 'everest-forms'),
2726 'JK' => __('DKI Jakarta', 'everest-forms'),
2727 'JB' => __('Jawa Barat', 'everest-forms'),
2728 'BT' => __('Banten', 'everest-forms'),
2729 'JT' => __('Jawa Tengah', 'everest-forms'),
2730 'JI' => __('Jawa Timur', 'everest-forms'),
2731 'YO' => __('Daerah Istimewa Yogyakarta', 'everest-forms'),
2732 'BA' => __('Bali', 'everest-forms'),
2733 'NB' => __('Nusa Tenggara Barat', 'everest-forms'),
2734 'NT' => __('Nusa Tenggara Timur', 'everest-forms'),
2735 'KB' => __('Kalimantan Barat', 'everest-forms'),
2736 'KT' => __('Kalimantan Tengah', 'everest-forms'),
2737 'KI' => __('Kalimantan Timur', 'everest-forms'),
2738 'KS' => __('Kalimantan Selatan', 'everest-forms'),
2739 'KU' => __('Kalimantan Utara', 'everest-forms'),
2740 'SA' => __('Sulawesi Utara', 'everest-forms'),
2741 'ST' => __('Sulawesi Tengah', 'everest-forms'),
2742 'SG' => __('Sulawesi Tenggara', 'everest-forms'),
2743 'SR' => __('Sulawesi Barat', 'everest-forms'),
2744 'SN' => __('Sulawesi Selatan', 'everest-forms'),
2745 'GO' => __('Gorontalo', 'everest-forms'),
2746 'MA' => __('Maluku', 'everest-forms'),
2747 'MU' => __('Maluku Utara', 'everest-forms'),
2748 'PA' => __('Papua', 'everest-forms'),
2749 'PB' => __('Papua Barat', 'everest-forms'),
2750 ),
2751 'IE' => array( // Irish states.
2752 'CW' => __('Carlow', 'everest-forms'),
2753 'CN' => __('Cavan', 'everest-forms'),
2754 'CE' => __('Clare', 'everest-forms'),
2755 'CO' => __('Cork', 'everest-forms'),
2756 'DL' => __('Donegal', 'everest-forms'),
2757 'D' => __('Dublin', 'everest-forms'),
2758 'G' => __('Galway', 'everest-forms'),
2759 'KY' => __('Kerry', 'everest-forms'),
2760 'KE' => __('Kildare', 'everest-forms'),
2761 'KK' => __('Kilkenny', 'everest-forms'),
2762 'LS' => __('Laois', 'everest-forms'),
2763 'LM' => __('Leitrim', 'everest-forms'),
2764 'LK' => __('Limerick', 'everest-forms'),
2765 'LD' => __('Longford', 'everest-forms'),
2766 'LH' => __('Louth', 'everest-forms'),
2767 'MO' => __('Mayo', 'everest-forms'),
2768 'MH' => __('Meath', 'everest-forms'),
2769 'MN' => __('Monaghan', 'everest-forms'),
2770 'OY' => __('Offaly', 'everest-forms'),
2771 'RN' => __('Roscommon', 'everest-forms'),
2772 'SO' => __('Sligo', 'everest-forms'),
2773 'TA' => __('Tipperary', 'everest-forms'),
2774 'WD' => __('Waterford', 'everest-forms'),
2775 'WH' => __('Westmeath', 'everest-forms'),
2776 'WX' => __('Wexford', 'everest-forms'),
2777 'WW' => __('Wicklow', 'everest-forms'),
2778 ),
2779 'IN' => array( // Indian states.
2780 'AP' => __('Andhra Pradesh', 'everest-forms'),
2781 'AR' => __('Arunachal Pradesh', 'everest-forms'),
2782 'AS' => __('Assam', 'everest-forms'),
2783 'BR' => __('Bihar', 'everest-forms'),
2784 'CT' => __('Chhattisgarh', 'everest-forms'),
2785 'GA' => __('Goa', 'everest-forms'),
2786 'GJ' => __('Gujarat', 'everest-forms'),
2787 'HR' => __('Haryana', 'everest-forms'),
2788 'HP' => __('Himachal Pradesh', 'everest-forms'),
2789 'JK' => __('Jammu and Kashmir', 'everest-forms'),
2790 'JH' => __('Jharkhand', 'everest-forms'),
2791 'KA' => __('Karnataka', 'everest-forms'),
2792 'KL' => __('Kerala', 'everest-forms'),
2793 'LA' => __('Ladakh', 'everest-forms'),
2794 'MP' => __('Madhya Pradesh', 'everest-forms'),
2795 'MH' => __('Maharashtra', 'everest-forms'),
2796 'MN' => __('Manipur', 'everest-forms'),
2797 'ML' => __('Meghalaya', 'everest-forms'),
2798 'MZ' => __('Mizoram', 'everest-forms'),
2799 'NL' => __('Nagaland', 'everest-forms'),
2800 'OR' => __('Odisha', 'everest-forms'),
2801 'PB' => __('Punjab', 'everest-forms'),
2802 'RJ' => __('Rajasthan', 'everest-forms'),
2803 'SK' => __('Sikkim', 'everest-forms'),
2804 'TN' => __('Tamil Nadu', 'everest-forms'),
2805 'TS' => __('Telangana', 'everest-forms'),
2806 'TR' => __('Tripura', 'everest-forms'),
2807 'UK' => __('Uttarakhand', 'everest-forms'),
2808 'UP' => __('Uttar Pradesh', 'everest-forms'),
2809 'WB' => __('West Bengal', 'everest-forms'),
2810 'AN' => __('Andaman and Nicobar Islands', 'everest-forms'),
2811 'CH' => __('Chandigarh', 'everest-forms'),
2812 'DN' => __('Dadra and Nagar Haveli', 'everest-forms'),
2813 'DD' => __('Daman and Diu', 'everest-forms'),
2814 'DL' => __('Delhi', 'everest-forms'),
2815 'LD' => __('Lakshadeep', 'everest-forms'),
2816 'PY' => __('Pondicherry (Puducherry)', 'everest-forms'),
2817 ),
2818 'IR' => array( // Irania states.
2819 'KHZ' => __('Khuzestan (خوزستان)', 'everest-forms'),
2820 'THR' => __('Tehran (تهران)', 'everest-forms'),
2821 'ILM' => __('Ilaam (ایلا�
2822 )', 'everest-forms'),
2823 'BHR' => __('Bushehr (بوشهر)', 'everest-forms'),
2824 'ADL' => __('Ardabil (اردبیل)', 'everest-forms'),
2825 'ESF' => __('Isfahan (اصفهان)', 'everest-forms'),
2826 'YZD' => __('Yazd (یزد)', 'everest-forms'),
2827 'KRH' => __('Kermanshah (کر�
2828 انشاه)', 'everest-forms'),
2829 'KRN' => __('Kerman (کر�
2830 ان)', 'everest-forms'),
2831 'HDN' => __('Hamadan (ه�
2832 دان)', 'everest-forms'),
2833 'GZN' => __('Ghazvin (قزوین)', 'everest-forms'),
2834 'ZJN' => __('Zanjan (زنجان)', 'everest-forms'),
2835 'LRS' => __('Luristan (لرستان)', 'everest-forms'),
2836 'ABZ' => __('Alborz (البرز)', 'everest-forms'),
2837 'EAZ' => __('East Azarbaijan (آذربایجان شرقی)', 'everest-forms'),
2838 'WAZ' => __('West Azarbaijan (آذربایجان غربی)', 'everest-forms'),
2839 'CHB' => __('Chaharmahal and Bakhtiari (چهار�
2840 حال و بختیاری)', 'everest-forms'),
2841 'SKH' => __('South Khorasan (خراسان جنوبی)', 'everest-forms'),
2842 'RKH' => __('Razavi Khorasan (خراسان رضوی)', 'everest-forms'),
2843 'NKH' => __('North Khorasan (خراسان ش�
2844 الی)', 'everest-forms'),
2845 'SMN' => __('Semnan (س�
2846 نان)', 'everest-forms'),
2847 'FRS' => __('Fars (فارس)', 'everest-forms'),
2848 'QHM' => __('Qom (ق�
2849 )', 'everest-forms'),
2850 'KRD' => __('Kurdistan / کردستان)', 'everest-forms'),
2851 'KBD' => __('Kohgiluyeh and BoyerAhmad (کهگیلوییه و بویراح�
2852 د)', 'everest-forms'),
2853 'GLS' => __('Golestan (گلستان)', 'everest-forms'),
2854 'GIL' => __('Gilan (گیلان)', 'everest-forms'),
2855 'MZN' => __('Mazandaran (�
2856 ازندران)', 'everest-forms'),
2857 'MKZ' => __('Markazi (�
2858 رکزی)', 'everest-forms'),
2859 'HRZ' => __('Hormozgan (هر�
2860 زگان)', 'everest-forms'),
2861 'SBN' => __('Sistan and Baluchestan (سیستان و بلوچستان)', 'everest-forms'),
2862 ),
2863 'IS' => array(),
2864 'IT' => array( // Italian provinces.
2865 'AG' => __('Agrigento', 'everest-forms'),
2866 'AL' => __('Alessandria', 'everest-forms'),
2867 'AN' => __('Ancona', 'everest-forms'),
2868 'AO' => __('Aosta', 'everest-forms'),
2869 'AR' => __('Arezzo', 'everest-forms'),
2870 'AP' => __('Ascoli Piceno', 'everest-forms'),
2871 'AT' => __('Asti', 'everest-forms'),
2872 'AV' => __('Avellino', 'everest-forms'),
2873 'BA' => __('Bari', 'everest-forms'),
2874 'BT' => __('Barletta-Andria-Trani', 'everest-forms'),
2875 'BL' => __('Belluno', 'everest-forms'),
2876 'BN' => __('Benevento', 'everest-forms'),
2877 'BG' => __('Bergamo', 'everest-forms'),
2878 'BI' => __('Biella', 'everest-forms'),
2879 'BO' => __('Bologna', 'everest-forms'),
2880 'BZ' => __('Bolzano', 'everest-forms'),
2881 'BS' => __('Brescia', 'everest-forms'),
2882 'BR' => __('Brindisi', 'everest-forms'),
2883 'CA' => __('Cagliari', 'everest-forms'),
2884 'CL' => __('Caltanissetta', 'everest-forms'),
2885 'CB' => __('Campobasso', 'everest-forms'),
2886 'CE' => __('Caserta', 'everest-forms'),
2887 'CT' => __('Catania', 'everest-forms'),
2888 'CZ' => __('Catanzaro', 'everest-forms'),
2889 'CH' => __('Chieti', 'everest-forms'),
2890 'CO' => __('Como', 'everest-forms'),
2891 'CS' => __('Cosenza', 'everest-forms'),
2892 'CR' => __('Cremona', 'everest-forms'),
2893 'KR' => __('Crotone', 'everest-forms'),
2894 'CN' => __('Cuneo', 'everest-forms'),
2895 'EN' => __('Enna', 'everest-forms'),
2896 'FM' => __('Fermo', 'everest-forms'),
2897 'FE' => __('Ferrara', 'everest-forms'),
2898 'FI' => __('Firenze', 'everest-forms'),
2899 'FG' => __('Foggia', 'everest-forms'),
2900 'FC' => __('Forlì-Cesena', 'everest-forms'),
2901 'FR' => __('Frosinone', 'everest-forms'),
2902 'GE' => __('Genova', 'everest-forms'),
2903 'GO' => __('Gorizia', 'everest-forms'),
2904 'GR' => __('Grosseto', 'everest-forms'),
2905 'IM' => __('Imperia', 'everest-forms'),
2906 'IS' => __('Isernia', 'everest-forms'),
2907 'SP' => __('La Spezia', 'everest-forms'),
2908 'AQ' => __("L'Aquila", 'everest-forms'),
2909 'LT' => __('Latina', 'everest-forms'),
2910 'LE' => __('Lecce', 'everest-forms'),
2911 'LC' => __('Lecco', 'everest-forms'),
2912 'LI' => __('Livorno', 'everest-forms'),
2913 'LO' => __('Lodi', 'everest-forms'),
2914 'LU' => __('Lucca', 'everest-forms'),
2915 'MC' => __('Macerata', 'everest-forms'),
2916 'MN' => __('Mantova', 'everest-forms'),
2917 'MS' => __('Massa-Carrara', 'everest-forms'),
2918 'MT' => __('Matera', 'everest-forms'),
2919 'ME' => __('Messina', 'everest-forms'),
2920 'MI' => __('Milano', 'everest-forms'),
2921 'MO' => __('Modena', 'everest-forms'),
2922 'MB' => __('Monza e della Brianza', 'everest-forms'),
2923 'NA' => __('Napoli', 'everest-forms'),
2924 'NO' => __('Novara', 'everest-forms'),
2925 'NU' => __('Nuoro', 'everest-forms'),
2926 'OR' => __('Oristano', 'everest-forms'),
2927 'PD' => __('Padova', 'everest-forms'),
2928 'PA' => __('Palermo', 'everest-forms'),
2929 'PR' => __('Parma', 'everest-forms'),
2930 'PV' => __('Pavia', 'everest-forms'),
2931 'PG' => __('Perugia', 'everest-forms'),
2932 'PU' => __('Pesaro e Urbino', 'everest-forms'),
2933 'PE' => __('Pescara', 'everest-forms'),
2934 'PC' => __('Piacenza', 'everest-forms'),
2935 'PI' => __('Pisa', 'everest-forms'),
2936 'PT' => __('Pistoia', 'everest-forms'),
2937 'PN' => __('Pordenone', 'everest-forms'),
2938 'PZ' => __('Potenza', 'everest-forms'),
2939 'PO' => __('Prato', 'everest-forms'),
2940 'RG' => __('Ragusa', 'everest-forms'),
2941 'RA' => __('Ravenna', 'everest-forms'),
2942 'RC' => __('Reggio Calabria', 'everest-forms'),
2943 'RE' => __('Reggio Emilia', 'everest-forms'),
2944 'RI' => __('Rieti', 'everest-forms'),
2945 'RN' => __('Rimini', 'everest-forms'),
2946 'RM' => __('Roma', 'everest-forms'),
2947 'RO' => __('Rovigo', 'everest-forms'),
2948 'SA' => __('Salerno', 'everest-forms'),
2949 'SS' => __('Sassari', 'everest-forms'),
2950 'SV' => __('Savona', 'everest-forms'),
2951 'SI' => __('Siena', 'everest-forms'),
2952 'SR' => __('Siracusa', 'everest-forms'),
2953 'SO' => __('Sondrio', 'everest-forms'),
2954 'SU' => __('Sud Sardegna', 'everest-forms'),
2955 'TA' => __('Taranto', 'everest-forms'),
2956 'TE' => __('Teramo', 'everest-forms'),
2957 'TR' => __('Terni', 'everest-forms'),
2958 'TO' => __('Torino', 'everest-forms'),
2959 'TP' => __('Trapani', 'everest-forms'),
2960 'TN' => __('Trento', 'everest-forms'),
2961 'TV' => __('Treviso', 'everest-forms'),
2962 'TS' => __('Trieste', 'everest-forms'),
2963 'UD' => __('Udine', 'everest-forms'),
2964 'VA' => __('Varese', 'everest-forms'),
2965 'VE' => __('Venezia', 'everest-forms'),
2966 'VB' => __('Verbano-Cusio-Ossola', 'everest-forms'),
2967 'VC' => __('Vercelli', 'everest-forms'),
2968 'VR' => __('Verona', 'everest-forms'),
2969 'VV' => __('Vibo Valentia', 'everest-forms'),
2970 'VI' => __('Vicenza', 'everest-forms'),
2971 'VT' => __('Viterbo', 'everest-forms'),
2972 ),
2973 'IL' => array(),
2974 'IM' => array(),
2975 'JM' => array( // Jamaican parishes.
2976 'JM-01' => __('Kingston', 'everest-forms'),
2977 'JM-02' => __('Saint Andrew', 'everest-forms'),
2978 'JM-03' => __('Saint Thomas', 'everest-forms'),
2979 'JM-04' => __('Portland', 'everest-forms'),
2980 'JM-05' => __('Saint Mary', 'everest-forms'),
2981 'JM-06' => __('Saint Ann', 'everest-forms'),
2982 'JM-07' => __('Trelawny', 'everest-forms'),
2983 'JM-08' => __('Saint James', 'everest-forms'),
2984 'JM-09' => __('Hanover', 'everest-forms'),
2985 'JM-10' => __('Westmoreland', 'everest-forms'),
2986 'JM-11' => __('Saint Elizabeth', 'everest-forms'),
2987 'JM-12' => __('Manchester', 'everest-forms'),
2988 'JM-13' => __('Clarendon', 'everest-forms'),
2989 'JM-14' => __('Saint Catherine', 'everest-forms'),
2990 ),
2991
2992 'JP' => array(
2993 'JP01' => __('Hokkaido', 'everest-forms'),
2994 'JP02' => __('Aomori', 'everest-forms'),
2995 'JP03' => __('Iwate', 'everest-forms'),
2996 'JP04' => __('Miyagi', 'everest-forms'),
2997 'JP05' => __('Akita', 'everest-forms'),
2998 'JP06' => __('Yamagata', 'everest-forms'),
2999 'JP07' => __('Fukushima', 'everest-forms'),
3000 'JP08' => __('Ibaraki', 'everest-forms'),
3001 'JP09' => __('Tochigi', 'everest-forms'),
3002 'JP10' => __('Gunma', 'everest-forms'),
3003 'JP11' => __('Saitama', 'everest-forms'),
3004 'JP12' => __('Chiba', 'everest-forms'),
3005 'JP13' => __('Tokyo', 'everest-forms'),
3006 'JP14' => __('Kanagawa', 'everest-forms'),
3007 'JP15' => __('Niigata', 'everest-forms'),
3008 'JP16' => __('Toyama', 'everest-forms'),
3009 'JP17' => __('Ishikawa', 'everest-forms'),
3010 'JP18' => __('Fukui', 'everest-forms'),
3011 'JP19' => __('Yamanashi', 'everest-forms'),
3012 'JP20' => __('Nagano', 'everest-forms'),
3013 'JP21' => __('Gifu', 'everest-forms'),
3014 'JP22' => __('Shizuoka', 'everest-forms'),
3015 'JP23' => __('Aichi', 'everest-forms'),
3016 'JP24' => __('Mie', 'everest-forms'),
3017 'JP25' => __('Shiga', 'everest-forms'),
3018 'JP26' => __('Kyoto', 'everest-forms'),
3019 'JP27' => __('Osaka', 'everest-forms'),
3020 'JP28' => __('Hyogo', 'everest-forms'),
3021 'JP29' => __('Nara', 'everest-forms'),
3022 'JP30' => __('Wakayama', 'everest-forms'),
3023 'JP31' => __('Tottori', 'everest-forms'),
3024 'JP32' => __('Shimane', 'everest-forms'),
3025 'JP33' => __('Okayama', 'everest-forms'),
3026 'JP34' => __('Hiroshima', 'everest-forms'),
3027 'JP35' => __('Yamaguchi', 'everest-forms'),
3028 'JP36' => __('Tokushima', 'everest-forms'),
3029 'JP37' => __('Kagawa', 'everest-forms'),
3030 'JP38' => __('Ehime', 'everest-forms'),
3031 'JP39' => __('Kochi', 'everest-forms'),
3032 'JP40' => __('Fukuoka', 'everest-forms'),
3033 'JP41' => __('Saga', 'everest-forms'),
3034 'JP42' => __('Nagasaki', 'everest-forms'),
3035 'JP43' => __('Kumamoto', 'everest-forms'),
3036 'JP44' => __('Oita', 'everest-forms'),
3037 'JP45' => __('Miyazaki', 'everest-forms'),
3038 'JP46' => __('Kagoshima', 'everest-forms'),
3039 'JP47' => __('Okinawa', 'everest-forms'),
3040 ),
3041 'KE' => array( // Kenyan counties.
3042 'KE01' => __('Baringo', 'everest-forms'),
3043 'KE02' => __('Bomet', 'everest-forms'),
3044 'KE03' => __('Bungoma', 'everest-forms'),
3045 'KE04' => __('Busia', 'everest-forms'),
3046 'KE05' => __('Elgeyo-Marakwet', 'everest-forms'),
3047 'KE06' => __('Embu', 'everest-forms'),
3048 'KE07' => __('Garissa', 'everest-forms'),
3049 'KE08' => __('Homa Bay', 'everest-forms'),
3050 'KE09' => __('Isiolo', 'everest-forms'),
3051 'KE10' => __('Kajiado', 'everest-forms'),
3052 'KE11' => __('Kakamega', 'everest-forms'),
3053 'KE12' => __('Kericho', 'everest-forms'),
3054 'KE13' => __('Kiambu', 'everest-forms'),
3055 'KE14' => __('Kilifi', 'everest-forms'),
3056 'KE15' => __('Kirinyaga', 'everest-forms'),
3057 'KE16' => __('Kisii', 'everest-forms'),
3058 'KE17' => __('Kisumu', 'everest-forms'),
3059 'KE18' => __('Kitui', 'everest-forms'),
3060 'KE19' => __('Kwale', 'everest-forms'),
3061 'KE20' => __('Laikipia', 'everest-forms'),
3062 'KE21' => __('Lamu', 'everest-forms'),
3063 'KE22' => __('Machakos', 'everest-forms'),
3064 'KE23' => __('Makueni', 'everest-forms'),
3065 'KE24' => __('Mandera', 'everest-forms'),
3066 'KE25' => __('Marsabit', 'everest-forms'),
3067 'KE26' => __('Meru', 'everest-forms'),
3068 'KE27' => __('Migori', 'everest-forms'),
3069 'KE28' => __('Mombasa', 'everest-forms'),
3070 'KE29' => __('Murang’a', 'everest-forms'),
3071 'KE30' => __('Nairobi County', 'everest-forms'),
3072 'KE31' => __('Nakuru', 'everest-forms'),
3073 'KE32' => __('Nandi', 'everest-forms'),
3074 'KE33' => __('Narok', 'everest-forms'),
3075 'KE34' => __('Nyamira', 'everest-forms'),
3076 'KE35' => __('Nyandarua', 'everest-forms'),
3077 'KE36' => __('Nyeri', 'everest-forms'),
3078 'KE37' => __('Samburu', 'everest-forms'),
3079 'KE38' => __('Siaya', 'everest-forms'),
3080 'KE39' => __('Taita-Taveta', 'everest-forms'),
3081 'KE40' => __('Tana River', 'everest-forms'),
3082 'KE41' => __('Tharaka-Nithi', 'everest-forms'),
3083 'KE42' => __('Trans Nzoia', 'everest-forms'),
3084 'KE43' => __('Turkana', 'everest-forms'),
3085 'KE44' => __('Uasin Gishu', 'everest-forms'),
3086 'KE45' => __('Vihiga', 'everest-forms'),
3087 'KE46' => __('Wajir', 'everest-forms'),
3088 'KE47' => __('West Pokot', 'everest-forms'),
3089 ),
3090 'KR' => array(),
3091 'KW' => array(),
3092 'LA' => array( // Laotian provinces.
3093 'AT' => __('Attapeu', 'everest-forms'),
3094 'BK' => __('Bokeo', 'everest-forms'),
3095 'BL' => __('Bolikhamsai', 'everest-forms'),
3096 'CH' => __('Champasak', 'everest-forms'),
3097 'HO' => __('Houaphanh', 'everest-forms'),
3098 'KH' => __('Khammouane', 'everest-forms'),
3099 'LM' => __('Luang Namtha', 'everest-forms'),
3100 'LP' => __('Luang Prabang', 'everest-forms'),
3101 'OU' => __('Oudomxay', 'everest-forms'),
3102 'PH' => __('Phongsaly', 'everest-forms'),
3103 'SL' => __('Salavan', 'everest-forms'),
3104 'SV' => __('Savannakhet', 'everest-forms'),
3105 'VI' => __('Vientiane Province', 'everest-forms'),
3106 'VT' => __('Vientiane', 'everest-forms'),
3107 'XA' => __('Sainyabuli', 'everest-forms'),
3108 'XE' => __('Sekong', 'everest-forms'),
3109 'XI' => __('Xiangkhouang', 'everest-forms'),
3110 'XS' => __('Xaisomboun', 'everest-forms'),
3111 ),
3112 'LB' => array(),
3113 'LR' => array( // Liberian provinces.
3114 'BM' => __('Bomi', 'everest-forms'),
3115 'BN' => __('Bong', 'everest-forms'),
3116 'GA' => __('Gbarpolu', 'everest-forms'),
3117 'GB' => __('Grand Bassa', 'everest-forms'),
3118 'GC' => __('Grand Cape Mount', 'everest-forms'),
3119 'GG' => __('Grand Gedeh', 'everest-forms'),
3120 'GK' => __('Grand Kru', 'everest-forms'),
3121 'LO' => __('Lofa', 'everest-forms'),
3122 'MA' => __('Margibi', 'everest-forms'),
3123 'MY' => __('Maryland', 'everest-forms'),
3124 'MO' => __('Montserrado', 'everest-forms'),
3125 'NM' => __('Nimba', 'everest-forms'),
3126 'RV' => __('Rivercess', 'everest-forms'),
3127 'RG' => __('River Gee', 'everest-forms'),
3128 'SN' => __('Sinoe', 'everest-forms'),
3129 ),
3130 'LU' => array(),
3131 'MD' => array( // Moldovan states.
3132 'C' => __('Chișinău', 'everest-forms'),
3133 'BL' => __('Bălți', 'everest-forms'),
3134 'AN' => __('Anenii Noi', 'everest-forms'),
3135 'BS' => __('Basarabeasca', 'everest-forms'),
3136 'BR' => __('Briceni', 'everest-forms'),
3137 'CH' => __('Cahul', 'everest-forms'),
3138 'CT' => __('Cantemir', 'everest-forms'),
3139 'CL' => __('Călărași', 'everest-forms'),
3140 'CS' => __('Căușeni', 'everest-forms'),
3141 'CM' => __('Cimișlia', 'everest-forms'),
3142 'CR' => __('Criuleni', 'everest-forms'),
3143 'DN' => __('Dondușeni', 'everest-forms'),
3144 'DR' => __('Drochia', 'everest-forms'),
3145 'DB' => __('Dubăsari', 'everest-forms'),
3146 'ED' => __('Edineț', 'everest-forms'),
3147 'FL' => __('Fălești', 'everest-forms'),
3148 'FR' => __('Florești', 'everest-forms'),
3149 'GE' => __('UTA Găgăuzia', 'everest-forms'),
3150 'GL' => __('Glodeni', 'everest-forms'),
3151 'HN' => __('Hîncești', 'everest-forms'),
3152 'IL' => __('Ialoveni', 'everest-forms'),
3153 'LV' => __('Leova', 'everest-forms'),
3154 'NS' => __('Nisporeni', 'everest-forms'),
3155 'OC' => __('Ocnița', 'everest-forms'),
3156 'OR' => __('Orhei', 'everest-forms'),
3157 'RZ' => __('Rezina', 'everest-forms'),
3158 'RS' => __('Rîșcani', 'everest-forms'),
3159 'SG' => __('Sîngerei', 'everest-forms'),
3160 'SR' => __('Soroca', 'everest-forms'),
3161 'ST' => __('Strășeni', 'everest-forms'),
3162 'SD' => __('Șoldănești', 'everest-forms'),
3163 'SV' => __('Ștefan Vodă', 'everest-forms'),
3164 'TR' => __('Taraclia', 'everest-forms'),
3165 'TL' => __('Telenești', 'everest-forms'),
3166 'UN' => __('Ungheni', 'everest-forms'),
3167 ),
3168 'MQ' => array(),
3169 'MT' => array(),
3170 'MX' => array( // Mexican states.
3171 'DF' => __('Ciudad de México', 'everest-forms'),
3172 'JA' => __('Jalisco', 'everest-forms'),
3173 'NL' => __('Nuevo León', 'everest-forms'),
3174 'AG' => __('Aguascalientes', 'everest-forms'),
3175 'BC' => __('Baja California', 'everest-forms'),
3176 'BS' => __('Baja California Sur', 'everest-forms'),
3177 'CM' => __('Campeche', 'everest-forms'),
3178 'CS' => __('Chiapas', 'everest-forms'),
3179 'CH' => __('Chihuahua', 'everest-forms'),
3180 'CO' => __('Coahuila', 'everest-forms'),
3181 'CL' => __('Colima', 'everest-forms'),
3182 'DG' => __('Durango', 'everest-forms'),
3183 'GT' => __('Guanajuato', 'everest-forms'),
3184 'GR' => __('Guerrero', 'everest-forms'),
3185 'HG' => __('Hidalgo', 'everest-forms'),
3186 'MX' => __('Estado de México', 'everest-forms'),
3187 'MI' => __('Michoacán', 'everest-forms'),
3188 'MO' => __('Morelos', 'everest-forms'),
3189 'NA' => __('Nayarit', 'everest-forms'),
3190 'OA' => __('Oaxaca', 'everest-forms'),
3191 'PU' => __('Puebla', 'everest-forms'),
3192 'QT' => __('Querétaro', 'everest-forms'),
3193 'QR' => __('Quintana Roo', 'everest-forms'),
3194 'SL' => __('San Luis Potosí', 'everest-forms'),
3195 'SI' => __('Sinaloa', 'everest-forms'),
3196 'SO' => __('Sonora', 'everest-forms'),
3197 'TB' => __('Tabasco', 'everest-forms'),
3198 'TM' => __('Tamaulipas', 'everest-forms'),
3199 'TL' => __('Tlaxcala', 'everest-forms'),
3200 'VE' => __('Veracruz', 'everest-forms'),
3201 'YU' => __('Yucatán', 'everest-forms'),
3202 'ZA' => __('Zacatecas', 'everest-forms'),
3203 ),
3204 'MY' => array( // Malaysian states.
3205 'JHR' => __('Johor', 'everest-forms'),
3206 'KDH' => __('Kedah', 'everest-forms'),
3207 'KTN' => __('Kelantan', 'everest-forms'),
3208 'LBN' => __('Labuan', 'everest-forms'),
3209 'MLK' => __('Malacca (Melaka)', 'everest-forms'),
3210 'NSN' => __('Negeri Sembilan', 'everest-forms'),
3211 'PHG' => __('Pahang', 'everest-forms'),
3212 'PNG' => __('Penang (Pulau Pinang)', 'everest-forms'),
3213 'PRK' => __('Perak', 'everest-forms'),
3214 'PLS' => __('Perlis', 'everest-forms'),
3215 'SBH' => __('Sabah', 'everest-forms'),
3216 'SWK' => __('Sarawak', 'everest-forms'),
3217 'SGR' => __('Selangor', 'everest-forms'),
3218 'TRG' => __('Terengganu', 'everest-forms'),
3219 'PJY' => __('Putrajaya', 'everest-forms'),
3220 'KUL' => __('Kuala Lumpur', 'everest-forms'),
3221 ),
3222 'MZ' => array( // Mozambican provinces.
3223 'MZP' => __('Cabo Delgado', 'everest-forms'),
3224 'MZG' => __('Gaza', 'everest-forms'),
3225 'MZI' => __('Inhambane', 'everest-forms'),
3226 'MZB' => __('Manica', 'everest-forms'),
3227 'MZL' => __('Maputo Province', 'everest-forms'),
3228 'MZMPM' => __('Maputo', 'everest-forms'),
3229 'MZN' => __('Nampula', 'everest-forms'),
3230 'MZA' => __('Niassa', 'everest-forms'),
3231 'MZS' => __('Sofala', 'everest-forms'),
3232 'MZT' => __('Tete', 'everest-forms'),
3233 'MZQ' => __('Zambézia', 'everest-forms'),
3234 ),
3235 'NA' => array( // Namibian regions.
3236 'ER' => __('Erongo', 'everest-forms'),
3237 'HA' => __('Hardap', 'everest-forms'),
3238 'KA' => __('Karas', 'everest-forms'),
3239 'KE' => __('Kavango East', 'everest-forms'),
3240 'KW' => __('Kavango West', 'everest-forms'),
3241 'KH' => __('Khomas', 'everest-forms'),
3242 'KU' => __('Kunene', 'everest-forms'),
3243 'OW' => __('Ohangwena', 'everest-forms'),
3244 'OH' => __('Omaheke', 'everest-forms'),
3245 'OS' => __('Omusati', 'everest-forms'),
3246 'ON' => __('Oshana', 'everest-forms'),
3247 'OT' => __('Oshikoto', 'everest-forms'),
3248 'OD' => __('Otjozondjupa', 'everest-forms'),
3249 'CA' => __('Zambezi', 'everest-forms'),
3250 ),
3251 'NG' => array( // Nigerian provinces.
3252 'AB' => __('Abia', 'everest-forms'),
3253 'FC' => __('Abuja', 'everest-forms'),
3254 'AD' => __('Adamawa', 'everest-forms'),
3255 'AK' => __('Akwa Ibom', 'everest-forms'),
3256 'AN' => __('Anambra', 'everest-forms'),
3257 'BA' => __('Bauchi', 'everest-forms'),
3258 'BY' => __('Bayelsa', 'everest-forms'),
3259 'BE' => __('Benue', 'everest-forms'),
3260 'BO' => __('Borno', 'everest-forms'),
3261 'CR' => __('Cross River', 'everest-forms'),
3262 'DE' => __('Delta', 'everest-forms'),
3263 'EB' => __('Ebonyi', 'everest-forms'),
3264 'ED' => __('Edo', 'everest-forms'),
3265 'EK' => __('Ekiti', 'everest-forms'),
3266 'EN' => __('Enugu', 'everest-forms'),
3267 'GO' => __('Gombe', 'everest-forms'),
3268 'IM' => __('Imo', 'everest-forms'),
3269 'JI' => __('Jigawa', 'everest-forms'),
3270 'KD' => __('Kaduna', 'everest-forms'),
3271 'KN' => __('Kano', 'everest-forms'),
3272 'KT' => __('Katsina', 'everest-forms'),
3273 'KE' => __('Kebbi', 'everest-forms'),
3274 'KO' => __('Kogi', 'everest-forms'),
3275 'KW' => __('Kwara', 'everest-forms'),
3276 'LA' => __('Lagos', 'everest-forms'),
3277 'NA' => __('Nasarawa', 'everest-forms'),
3278 'NI' => __('Niger', 'everest-forms'),
3279 'OG' => __('Ogun', 'everest-forms'),
3280 'ON' => __('Ondo', 'everest-forms'),
3281 'OS' => __('Osun', 'everest-forms'),
3282 'OY' => __('Oyo', 'everest-forms'),
3283 'PL' => __('Plateau', 'everest-forms'),
3284 'RI' => __('Rivers', 'everest-forms'),
3285 'SO' => __('Sokoto', 'everest-forms'),
3286 'TA' => __('Taraba', 'everest-forms'),
3287 'YO' => __('Yobe', 'everest-forms'),
3288 'ZA' => __('Zamfara', 'everest-forms'),
3289 ),
3290 'NL' => array(),
3291 'NO' => array(),
3292 'NP' => array( // Nepalese zones.
3293 'BAG' => __('Bagmati', 'everest-forms'),
3294 'BHE' => __('Bheri', 'everest-forms'),
3295 'DHA' => __('Dhaulagiri', 'everest-forms'),
3296 'GAN' => __('Gandaki', 'everest-forms'),
3297 'JAN' => __('Janakpur', 'everest-forms'),
3298 'KAR' => __('Karnali', 'everest-forms'),
3299 'KOS' => __('Koshi', 'everest-forms'),
3300 'LUM' => __('Lumbini', 'everest-forms'),
3301 'MAH' => __('Mahakali', 'everest-forms'),
3302 'MEC' => __('Mechi', 'everest-forms'),
3303 'NAR' => __('Narayani', 'everest-forms'),
3304 'RAP' => __('Rapti', 'everest-forms'),
3305 'SAG' => __('Sagarmatha', 'everest-forms'),
3306 'SET' => __('Seti', 'everest-forms'),
3307 ),
3308 'NI' => array( // Nicaraguan states.
3309 'NI-AN' => __('Atlántico Norte', 'everest-forms'),
3310 'NI-AS' => __('Atlántico Sur', 'everest-forms'),
3311 'NI-BO' => __('Boaco', 'everest-forms'),
3312 'NI-CA' => __('Carazo', 'everest-forms'),
3313 'NI-CI' => __('Chinandega', 'everest-forms'),
3314 'NI-CO' => __('Chontales', 'everest-forms'),
3315 'NI-ES' => __('Estelí', 'everest-forms'),
3316 'NI-GR' => __('Granada', 'everest-forms'),
3317 'NI-JI' => __('Jinotega', 'everest-forms'),
3318 'NI-LE' => __('León', 'everest-forms'),
3319 'NI-MD' => __('Madriz', 'everest-forms'),
3320 'NI-MN' => __('Managua', 'everest-forms'),
3321 'NI-MS' => __('Masaya', 'everest-forms'),
3322 'NI-MT' => __('Matagalpa', 'everest-forms'),
3323 'NI-NS' => __('Nueva Segovia', 'everest-forms'),
3324 'NI-RI' => __('Rivas', 'everest-forms'),
3325 'NI-SJ' => __('Río San Juan', 'everest-forms'),
3326 ),
3327 'NZ' => array( // New Zealand states.
3328 'NL' => __('Northland', 'everest-forms'),
3329 'AK' => __('Auckland', 'everest-forms'),
3330 'WA' => __('Waikato', 'everest-forms'),
3331 'BP' => __('Bay of Plenty', 'everest-forms'),
3332 'TK' => __('Taranaki', 'everest-forms'),
3333 'GI' => __('Gisborne', 'everest-forms'),
3334 'HB' => __('Hawke’s Bay', 'everest-forms'),
3335 'MW' => __('Manawatu-Wanganui', 'everest-forms'),
3336 'WE' => __('Wellington', 'everest-forms'),
3337 'NS' => __('Nelson', 'everest-forms'),
3338 'MB' => __('Marlborough', 'everest-forms'),
3339 'TM' => __('Tasman', 'everest-forms'),
3340 'WC' => __('West Coast', 'everest-forms'),
3341 'CT' => __('Canterbury', 'everest-forms'),
3342 'OT' => __('Otago', 'everest-forms'),
3343 'SL' => __('Southland', 'everest-forms'),
3344 ),
3345 'PA' => array( // Panamanian states.
3346 'PA-1' => __('Bocas del Toro', 'everest-forms'),
3347 'PA-2' => __('Coclé', 'everest-forms'),
3348 'PA-3' => __('Colón', 'everest-forms'),
3349 'PA-4' => __('Chiriquí', 'everest-forms'),
3350 'PA-5' => __('Darién', 'everest-forms'),
3351 'PA-6' => __('Herrera', 'everest-forms'),
3352 'PA-7' => __('Los Santos', 'everest-forms'),
3353 'PA-8' => __('Panamá', 'everest-forms'),
3354 'PA-9' => __('Veraguas', 'everest-forms'),
3355 'PA-10' => __('West Panamá', 'everest-forms'),
3356 'PA-EM' => __('Emberá', 'everest-forms'),
3357 'PA-KY' => __('Guna Yala', 'everest-forms'),
3358 'PA-NB' => __('Ngöbe-Buglé', 'everest-forms'),
3359 ),
3360 'PE' => array( // Peruvian states.
3361 'CAL' => __('El Callao', 'everest-forms'),
3362 'LMA' => __('Municipalidad Metropolitana de Lima', 'everest-forms'),
3363 'AMA' => __('Amazonas', 'everest-forms'),
3364 'ANC' => __('Ancash', 'everest-forms'),
3365 'APU' => __('Apurímac', 'everest-forms'),
3366 'ARE' => __('Arequipa', 'everest-forms'),
3367 'AYA' => __('Ayacucho', 'everest-forms'),
3368 'CAJ' => __('Cajamarca', 'everest-forms'),
3369 'CUS' => __('Cusco', 'everest-forms'),
3370 'HUV' => __('Huancavelica', 'everest-forms'),
3371 'HUC' => __('Huánuco', 'everest-forms'),
3372 'ICA' => __('Ica', 'everest-forms'),
3373 'JUN' => __('Junín', 'everest-forms'),
3374 'LAL' => __('La Libertad', 'everest-forms'),
3375 'LAM' => __('Lambayeque', 'everest-forms'),
3376 'LIM' => __('Lima', 'everest-forms'),
3377 'LOR' => __('Loreto', 'everest-forms'),
3378 'MDD' => __('Madre de Dios', 'everest-forms'),
3379 'MOQ' => __('Moquegua', 'everest-forms'),
3380 'PAS' => __('Pasco', 'everest-forms'),
3381 'PIU' => __('Piura', 'everest-forms'),
3382 'PUN' => __('Puno', 'everest-forms'),
3383 'SAM' => __('San Martín', 'everest-forms'),
3384 'TAC' => __('Tacna', 'everest-forms'),
3385 'TUM' => __('Tumbes', 'everest-forms'),
3386 'UCA' => __('Ucayali', 'everest-forms'),
3387 ),
3388 'PH' => array( // Philippine provinces.
3389 'ABR' => __('Abra', 'everest-forms'),
3390 'AGN' => __('Agusan del Norte', 'everest-forms'),
3391 'AGS' => __('Agusan del Sur', 'everest-forms'),
3392 'AKL' => __('Aklan', 'everest-forms'),
3393 'ALB' => __('Albay', 'everest-forms'),
3394 'ANT' => __('Antique', 'everest-forms'),
3395 'APA' => __('Apayao', 'everest-forms'),
3396 'AUR' => __('Aurora', 'everest-forms'),
3397 'BAS' => __('Basilan', 'everest-forms'),
3398 'BAN' => __('Bataan', 'everest-forms'),
3399 'BTN' => __('Batanes', 'everest-forms'),
3400 'BTG' => __('Batangas', 'everest-forms'),
3401 'BEN' => __('Benguet', 'everest-forms'),
3402 'BIL' => __('Biliran', 'everest-forms'),
3403 'BOH' => __('Bohol', 'everest-forms'),
3404 'BUK' => __('Bukidnon', 'everest-forms'),
3405 'BUL' => __('Bulacan', 'everest-forms'),
3406 'CAG' => __('Cagayan', 'everest-forms'),
3407 'CAN' => __('Camarines Norte', 'everest-forms'),
3408 'CAS' => __('Camarines Sur', 'everest-forms'),
3409 'CAM' => __('Camiguin', 'everest-forms'),
3410 'CAP' => __('Capiz', 'everest-forms'),
3411 'CAT' => __('Catanduanes', 'everest-forms'),
3412 'CAV' => __('Cavite', 'everest-forms'),
3413 'CEB' => __('Cebu', 'everest-forms'),
3414 'COM' => __('Compostela Valley', 'everest-forms'),
3415 'NCO' => __('Cotabato', 'everest-forms'),
3416 'DAV' => __('Davao del Norte', 'everest-forms'),
3417 'DAS' => __('Davao del Sur', 'everest-forms'),
3418 'DAC' => __('Davao Occidental', 'everest-forms'),
3419 'DAO' => __('Davao Oriental', 'everest-forms'),
3420 'DIN' => __('Dinagat Islands', 'everest-forms'),
3421 'EAS' => __('Eastern Samar', 'everest-forms'),
3422 'GUI' => __('Guimaras', 'everest-forms'),
3423 'IFU' => __('Ifugao', 'everest-forms'),
3424 'ILN' => __('Ilocos Norte', 'everest-forms'),
3425 'ILS' => __('Ilocos Sur', 'everest-forms'),
3426 'ILI' => __('Iloilo', 'everest-forms'),
3427 'ISA' => __('Isabela', 'everest-forms'),
3428 'KAL' => __('Kalinga', 'everest-forms'),
3429 'LUN' => __('La Union', 'everest-forms'),
3430 'LAG' => __('Laguna', 'everest-forms'),
3431 'LAN' => __('Lanao del Norte', 'everest-forms'),
3432 'LAS' => __('Lanao del Sur', 'everest-forms'),
3433 'LEY' => __('Leyte', 'everest-forms'),
3434 'MAG' => __('Maguindanao', 'everest-forms'),
3435 'MAD' => __('Marinduque', 'everest-forms'),
3436 'MAS' => __('Masbate', 'everest-forms'),
3437 'MSC' => __('Misamis Occidental', 'everest-forms'),
3438 'MSR' => __('Misamis Oriental', 'everest-forms'),
3439 'MOU' => __('Mountain Province', 'everest-forms'),
3440 'NEC' => __('Negros Occidental', 'everest-forms'),
3441 'NER' => __('Negros Oriental', 'everest-forms'),
3442 'NSA' => __('Northern Samar', 'everest-forms'),
3443 'NUE' => __('Nueva Ecija', 'everest-forms'),
3444 'NUV' => __('Nueva Vizcaya', 'everest-forms'),
3445 'MDC' => __('Occidental Mindoro', 'everest-forms'),
3446 'MDR' => __('Oriental Mindoro', 'everest-forms'),
3447 'PLW' => __('Palawan', 'everest-forms'),
3448 'PAM' => __('Pampanga', 'everest-forms'),
3449 'PAN' => __('Pangasinan', 'everest-forms'),
3450 'QUE' => __('Quezon', 'everest-forms'),
3451 'QUI' => __('Quirino', 'everest-forms'),
3452 'RIZ' => __('Rizal', 'everest-forms'),
3453 'ROM' => __('Romblon', 'everest-forms'),
3454 'WSA' => __('Samar', 'everest-forms'),
3455 'SAR' => __('Sarangani', 'everest-forms'),
3456 'SIQ' => __('Siquijor', 'everest-forms'),
3457 'SOR' => __('Sorsogon', 'everest-forms'),
3458 'SCO' => __('South Cotabato', 'everest-forms'),
3459 'SLE' => __('Southern Leyte', 'everest-forms'),
3460 'SUK' => __('Sultan Kudarat', 'everest-forms'),
3461 'SLU' => __('Sulu', 'everest-forms'),
3462 'SUN' => __('Surigao del Norte', 'everest-forms'),
3463 'SUR' => __('Surigao del Sur', 'everest-forms'),
3464 'TAR' => __('Tarlac', 'everest-forms'),
3465 'TAW' => __('Tawi-Tawi', 'everest-forms'),
3466 'ZMB' => __('Zambales', 'everest-forms'),
3467 'ZAN' => __('Zamboanga del Norte', 'everest-forms'),
3468 'ZAS' => __('Zamboanga del Sur', 'everest-forms'),
3469 'ZSI' => __('Zamboanga Sibugay', 'everest-forms'),
3470 '00' => __('Metro Manila', 'everest-forms'),
3471 ),
3472 'PK' => array( // Pakistani states.
3473 'JK' => __('Azad Kashmir', 'everest-forms'),
3474 'BA' => __('Balochistan', 'everest-forms'),
3475 'TA' => __('FATA', 'everest-forms'),
3476 'GB' => __('Gilgit Baltistan', 'everest-forms'),
3477 'IS' => __('Islamabad Capital Territory', 'everest-forms'),
3478 'KP' => __('Khyber Pakhtunkhwa', 'everest-forms'),
3479 'PB' => __('Punjab', 'everest-forms'),
3480 'SD' => __('Sindh', 'everest-forms'),
3481 ),
3482 'PL' => array(),
3483 'PR' => array(),
3484 'PT' => array(),
3485 'PY' => array( // Paraguayan states.
3486 'PY-ASU' => __('Asunción', 'everest-forms'),
3487 'PY-1' => __('Concepción', 'everest-forms'),
3488 'PY-2' => __('San Pedro', 'everest-forms'),
3489 'PY-3' => __('Cordillera', 'everest-forms'),
3490 'PY-4' => __('Guairá', 'everest-forms'),
3491 'PY-5' => __('Caaguazú', 'everest-forms'),
3492 'PY-6' => __('Caazapá', 'everest-forms'),
3493 'PY-7' => __('Itapúa', 'everest-forms'),
3494 'PY-8' => __('Misiones', 'everest-forms'),
3495 'PY-9' => __('Paraguarí', 'everest-forms'),
3496 'PY-10' => __('Alto Paraná', 'everest-forms'),
3497 'PY-11' => __('Central', 'everest-forms'),
3498 'PY-12' => __('Ñeembucú', 'everest-forms'),
3499 'PY-13' => __('Amambay', 'everest-forms'),
3500 'PY-14' => __('Canindeyú', 'everest-forms'),
3501 'PY-15' => __('Presidente Hayes', 'everest-forms'),
3502 'PY-16' => __('Alto Paraguay', 'everest-forms'),
3503 'PY-17' => __('Boquerón', 'everest-forms'),
3504 ),
3505 'RE' => array(),
3506 'RO' => array( // Romanian states.
3507 'AB' => __('Alba', 'everest-forms'),
3508 'AR' => __('Arad', 'everest-forms'),
3509 'AG' => __('Argeș', 'everest-forms'),
3510 'BC' => __('Bacău', 'everest-forms'),
3511 'BH' => __('Bihor', 'everest-forms'),
3512 'BN' => __('Bistrița-Năsăud', 'everest-forms'),
3513 'BT' => __('Botoșani', 'everest-forms'),
3514 'BR' => __('Brăila', 'everest-forms'),
3515 'BV' => __('Brașov', 'everest-forms'),
3516 'B' => __('București', 'everest-forms'),
3517 'BZ' => __('Buzău', 'everest-forms'),
3518 'CL' => __('Călărași', 'everest-forms'),
3519 'CS' => __('Caraș-Severin', 'everest-forms'),
3520 'CJ' => __('Cluj', 'everest-forms'),
3521 'CT' => __('Constanța', 'everest-forms'),
3522 'CV' => __('Covasna', 'everest-forms'),
3523 'DB' => __('Dâmbovița', 'everest-forms'),
3524 'DJ' => __('Dolj', 'everest-forms'),
3525 'GL' => __('Galați', 'everest-forms'),
3526 'GR' => __('Giurgiu', 'everest-forms'),
3527 'GJ' => __('Gorj', 'everest-forms'),
3528 'HR' => __('Harghita', 'everest-forms'),
3529 'HD' => __('Hunedoara', 'everest-forms'),
3530 'IL' => __('Ialomița', 'everest-forms'),
3531 'IS' => __('Iași', 'everest-forms'),
3532 'IF' => __('Ilfov', 'everest-forms'),
3533 'MM' => __('Maramureș', 'everest-forms'),
3534 'MH' => __('Mehedinți', 'everest-forms'),
3535 'MS' => __('Mureș', 'everest-forms'),
3536 'NT' => __('Neamț', 'everest-forms'),
3537 'OT' => __('Olt', 'everest-forms'),
3538 'PH' => __('Prahova', 'everest-forms'),
3539 'SJ' => __('Sălaj', 'everest-forms'),
3540 'SM' => __('Satu Mare', 'everest-forms'),
3541 'SB' => __('Sibiu', 'everest-forms'),
3542 'SV' => __('Suceava', 'everest-forms'),
3543 'TR' => __('Teleorman', 'everest-forms'),
3544 'TM' => __('Timiș', 'everest-forms'),
3545 'TL' => __('Tulcea', 'everest-forms'),
3546 'VL' => __('Vâlcea', 'everest-forms'),
3547 'VS' => __('Vaslui', 'everest-forms'),
3548 'VN' => __('Vrancea', 'everest-forms'),
3549 ),
3550 'SG' => array(),
3551 'SK' => array(),
3552 'SI' => array(),
3553 'SV' => array( // Salvadoran states.
3554 'SV-AH' => __('Ahuachapán', 'everest-forms'),
3555 'SV-CA' => __('Cabañas', 'everest-forms'),
3556 'SV-CH' => __('Chalatenango', 'everest-forms'),
3557 'SV-CU' => __('Cuscatlán', 'everest-forms'),
3558 'SV-LI' => __('La Libertad', 'everest-forms'),
3559 'SV-MO' => __('Morazán', 'everest-forms'),
3560 'SV-PA' => __('La Paz', 'everest-forms'),
3561 'SV-SA' => __('Santa Ana', 'everest-forms'),
3562 'SV-SM' => __('San Miguel', 'everest-forms'),
3563 'SV-SO' => __('Sonsonate', 'everest-forms'),
3564 'SV-SS' => __('San Salvador', 'everest-forms'),
3565 'SV-SV' => __('San Vicente', 'everest-forms'),
3566 'SV-UN' => __('La Unión', 'everest-forms'),
3567 'SV-US' => __('Usulután', 'everest-forms'),
3568 ),
3569 'TH' => array( // Thai states.
3570 'TH-37' => __('Amnat Charoen', 'everest-forms'),
3571 'TH-15' => __('Ang Thong', 'everest-forms'),
3572 'TH-14' => __('Ayutthaya', 'everest-forms'),
3573 'TH-10' => __('Bangkok', 'everest-forms'),
3574 'TH-38' => __('Bueng Kan', 'everest-forms'),
3575 'TH-31' => __('Buri Ram', 'everest-forms'),
3576 'TH-24' => __('Chachoengsao', 'everest-forms'),
3577 'TH-18' => __('Chai Nat', 'everest-forms'),
3578 'TH-36' => __('Chaiyaphum', 'everest-forms'),
3579 'TH-22' => __('Chanthaburi', 'everest-forms'),
3580 'TH-50' => __('Chiang Mai', 'everest-forms'),
3581 'TH-57' => __('Chiang Rai', 'everest-forms'),
3582 'TH-20' => __('Chonburi', 'everest-forms'),
3583 'TH-86' => __('Chumphon', 'everest-forms'),
3584 'TH-46' => __('Kalasin', 'everest-forms'),
3585 'TH-62' => __('Kamphaeng Phet', 'everest-forms'),
3586 'TH-71' => __('Kanchanaburi', 'everest-forms'),
3587 'TH-40' => __('Khon Kaen', 'everest-forms'),
3588 'TH-81' => __('Krabi', 'everest-forms'),
3589 'TH-52' => __('Lampang', 'everest-forms'),
3590 'TH-51' => __('Lamphun', 'everest-forms'),
3591 'TH-42' => __('Loei', 'everest-forms'),
3592 'TH-16' => __('Lopburi', 'everest-forms'),
3593 'TH-58' => __('Mae Hong Son', 'everest-forms'),
3594 'TH-44' => __('Maha Sarakham', 'everest-forms'),
3595 'TH-49' => __('Mukdahan', 'everest-forms'),
3596 'TH-26' => __('Nakhon Nayok', 'everest-forms'),
3597 'TH-73' => __('Nakhon Pathom', 'everest-forms'),
3598 'TH-48' => __('Nakhon Phanom', 'everest-forms'),
3599 'TH-30' => __('Nakhon Ratchasima', 'everest-forms'),
3600 'TH-60' => __('Nakhon Sawan', 'everest-forms'),
3601 'TH-80' => __('Nakhon Si Thammarat', 'everest-forms'),
3602 'TH-55' => __('Nan', 'everest-forms'),
3603 'TH-96' => __('Narathiwat', 'everest-forms'),
3604 'TH-39' => __('Nong Bua Lam Phu', 'everest-forms'),
3605 'TH-43' => __('Nong Khai', 'everest-forms'),
3606 'TH-12' => __('Nonthaburi', 'everest-forms'),
3607 'TH-13' => __('Pathum Thani', 'everest-forms'),
3608 'TH-94' => __('Pattani', 'everest-forms'),
3609 'TH-82' => __('Phang Nga', 'everest-forms'),
3610 'TH-93' => __('Phatthalung', 'everest-forms'),
3611 'TH-56' => __('Phayao', 'everest-forms'),
3612 'TH-67' => __('Phetchabun', 'everest-forms'),
3613 'TH-76' => __('Phetchaburi', 'everest-forms'),
3614 'TH-66' => __('Phichit', 'everest-forms'),
3615 'TH-65' => __('Phitsanulok', 'everest-forms'),
3616 'TH-54' => __('Phrae', 'everest-forms'),
3617 'TH-83' => __('Phuket', 'everest-forms'),
3618 'TH-25' => __('Prachin Buri', 'everest-forms'),
3619 'TH-77' => __('Prachuap Khiri Khan', 'everest-forms'),
3620 'TH-85' => __('Ranong', 'everest-forms'),
3621 'TH-70' => __('Ratchaburi', 'everest-forms'),
3622 'TH-21' => __('Rayong', 'everest-forms'),
3623 'TH-45' => __('Roi Et', 'everest-forms'),
3624 'TH-27' => __('Sa Kaeo', 'everest-forms'),
3625 'TH-47' => __('Sakon Nakhon', 'everest-forms'),
3626 'TH-11' => __('Samut Prakan', 'everest-forms'),
3627 'TH-74' => __('Samut Sakhon', 'everest-forms'),
3628 'TH-75' => __('Samut Songkhram', 'everest-forms'),
3629 'TH-19' => __('Saraburi', 'everest-forms'),
3630 'TH-91' => __('Satun', 'everest-forms'),
3631 'TH-17' => __('Sing Buri', 'everest-forms'),
3632 'TH-33' => __('Sisaket', 'everest-forms'),
3633 'TH-90' => __('Songkhla', 'everest-forms'),
3634 'TH-64' => __('Sukhothai', 'everest-forms'),
3635 'TH-72' => __('Suphan Buri', 'everest-forms'),
3636 'TH-84' => __('Surat Thani', 'everest-forms'),
3637 'TH-32' => __('Surin', 'everest-forms'),
3638 'TH-63' => __('Tak', 'everest-forms'),
3639 'TH-92' => __('Trang', 'everest-forms'),
3640 'TH-23' => __('Trat', 'everest-forms'),
3641 'TH-34' => __('Ubon Ratchathani', 'everest-forms'),
3642 'TH-41' => __('Udon Thani', 'everest-forms'),
3643 'TH-61' => __('Uthai Thani', 'everest-forms'),
3644 'TH-53' => __('Uttaradit', 'everest-forms'),
3645 'TH-95' => __('Yala', 'everest-forms'),
3646 'TH-35' => __('Yasothon', 'everest-forms'),
3647 ),
3648 'TR' => array( // Turkish states.
3649 'TR01' => __('Adana', 'everest-forms'),
3650 'TR02' => __('Adıyaman', 'everest-forms'),
3651 'TR03' => __('Afyon', 'everest-forms'),
3652 'TR04' => __('Ağrı', 'everest-forms'),
3653 'TR05' => __('Amasya', 'everest-forms'),
3654 'TR06' => __('Ankara', 'everest-forms'),
3655 'TR07' => __('Antalya', 'everest-forms'),
3656 'TR08' => __('Artvin', 'everest-forms'),
3657 'TR09' => __('Aydın', 'everest-forms'),
3658 'TR10' => __('Balıkesir', 'everest-forms'),
3659 'TR11' => __('Bilecik', 'everest-forms'),
3660 'TR12' => __('Bingöl', 'everest-forms'),
3661 'TR13' => __('Bitlis', 'everest-forms'),
3662 'TR14' => __('Bolu', 'everest-forms'),
3663 'TR15' => __('Burdur', 'everest-forms'),
3664 'TR16' => __('Bursa', 'everest-forms'),
3665 'TR17' => __('Çanakkale', 'everest-forms'),
3666 'TR18' => __('Çankırı', 'everest-forms'),
3667 'TR19' => __('Çorum', 'everest-forms'),
3668 'TR20' => __('Denizli', 'everest-forms'),
3669 'TR21' => __('Diyarbakır', 'everest-forms'),
3670 'TR22' => __('Edirne', 'everest-forms'),
3671 'TR23' => __('Elazığ', 'everest-forms'),
3672 'TR24' => __('Erzincan', 'everest-forms'),
3673 'TR25' => __('Erzurum', 'everest-forms'),
3674 'TR26' => __('Eskişehir', 'everest-forms'),
3675 'TR27' => __('Gaziantep', 'everest-forms'),
3676 'TR28' => __('Giresun', 'everest-forms'),
3677 'TR29' => __('Gümüşhane', 'everest-forms'),
3678 'TR30' => __('Hakkari', 'everest-forms'),
3679 'TR31' => __('Hatay', 'everest-forms'),
3680 'TR32' => __('Isparta', 'everest-forms'),
3681 'TR33' => __('İçel', 'everest-forms'),
3682 'TR34' => __('İstanbul', 'everest-forms'),
3683 'TR35' => __('İzmir', 'everest-forms'),
3684 'TR36' => __('Kars', 'everest-forms'),
3685 'TR37' => __('Kastamonu', 'everest-forms'),
3686 'TR38' => __('Kayseri', 'everest-forms'),
3687 'TR39' => __('Kırklareli', 'everest-forms'),
3688 'TR40' => __('Kırşehir', 'everest-forms'),
3689 'TR41' => __('Kocaeli', 'everest-forms'),
3690 'TR42' => __('Konya', 'everest-forms'),
3691 'TR43' => __('Kütahya', 'everest-forms'),
3692 'TR44' => __('Malatya', 'everest-forms'),
3693 'TR45' => __('Manisa', 'everest-forms'),
3694 'TR46' => __('Kahramanmaraş', 'everest-forms'),
3695 'TR47' => __('Mardin', 'everest-forms'),
3696 'TR48' => __('Muğla', 'everest-forms'),
3697 'TR49' => __('Muş', 'everest-forms'),
3698 'TR50' => __('Nevşehir', 'everest-forms'),
3699 'TR51' => __('Niğde', 'everest-forms'),
3700 'TR52' => __('Ordu', 'everest-forms'),
3701 'TR53' => __('Rize', 'everest-forms'),
3702 'TR54' => __('Sakarya', 'everest-forms'),
3703 'TR55' => __('Samsun', 'everest-forms'),
3704 'TR56' => __('Siirt', 'everest-forms'),
3705 'TR57' => __('Sinop', 'everest-forms'),
3706 'TR58' => __('Sivas', 'everest-forms'),
3707 'TR59' => __('Tekirdağ', 'everest-forms'),
3708 'TR60' => __('Tokat', 'everest-forms'),
3709 'TR61' => __('Trabzon', 'everest-forms'),
3710 'TR62' => __('Tunceli', 'everest-forms'),
3711 'TR63' => __('Şanlıurfa', 'everest-forms'),
3712 'TR64' => __('Uşak', 'everest-forms'),
3713 'TR65' => __('Van', 'everest-forms'),
3714 'TR66' => __('Yozgat', 'everest-forms'),
3715 'TR67' => __('Zonguldak', 'everest-forms'),
3716 'TR68' => __('Aksaray', 'everest-forms'),
3717 'TR69' => __('Bayburt', 'everest-forms'),
3718 'TR70' => __('Karaman', 'everest-forms'),
3719 'TR71' => __('Kırıkkale', 'everest-forms'),
3720 'TR72' => __('Batman', 'everest-forms'),
3721 'TR73' => __('Şırnak', 'everest-forms'),
3722 'TR74' => __('Bartın', 'everest-forms'),
3723 'TR75' => __('Ardahan', 'everest-forms'),
3724 'TR76' => __('Iğdır', 'everest-forms'),
3725 'TR77' => __('Yalova', 'everest-forms'),
3726 'TR78' => __('Karabük', 'everest-forms'),
3727 'TR79' => __('Kilis', 'everest-forms'),
3728 'TR80' => __('Osmaniye', 'everest-forms'),
3729 'TR81' => __('Düzce', 'everest-forms'),
3730 ),
3731 'TZ' => array( // Tanzanian states.
3732 'TZ01' => __('Arusha', 'everest-forms'),
3733 'TZ02' => __('Dar es Salaam', 'everest-forms'),
3734 'TZ03' => __('Dodoma', 'everest-forms'),
3735 'TZ04' => __('Iringa', 'everest-forms'),
3736 'TZ05' => __('Kagera', 'everest-forms'),
3737 'TZ06' => __('Pemba North', 'everest-forms'),
3738 'TZ07' => __('Zanzibar North', 'everest-forms'),
3739 'TZ08' => __('Kigoma', 'everest-forms'),
3740 'TZ09' => __('Kilimanjaro', 'everest-forms'),
3741 'TZ10' => __('Pemba South', 'everest-forms'),
3742 'TZ11' => __('Zanzibar South', 'everest-forms'),
3743 'TZ12' => __('Lindi', 'everest-forms'),
3744 'TZ13' => __('Mara', 'everest-forms'),
3745 'TZ14' => __('Mbeya', 'everest-forms'),
3746 'TZ15' => __('Zanzibar West', 'everest-forms'),
3747 'TZ16' => __('Morogoro', 'everest-forms'),
3748 'TZ17' => __('Mtwara', 'everest-forms'),
3749 'TZ18' => __('Mwanza', 'everest-forms'),
3750 'TZ19' => __('Coast', 'everest-forms'),
3751 'TZ20' => __('Rukwa', 'everest-forms'),
3752 'TZ21' => __('Ruvuma', 'everest-forms'),
3753 'TZ22' => __('Shinyanga', 'everest-forms'),
3754 'TZ23' => __('Singida', 'everest-forms'),
3755 'TZ24' => __('Tabora', 'everest-forms'),
3756 'TZ25' => __('Tanga', 'everest-forms'),
3757 'TZ26' => __('Manyara', 'everest-forms'),
3758 'TZ27' => __('Geita', 'everest-forms'),
3759 'TZ28' => __('Katavi', 'everest-forms'),
3760 'TZ29' => __('Njombe', 'everest-forms'),
3761 'TZ30' => __('Simiyu', 'everest-forms'),
3762 ),
3763 'LK' => array(),
3764 'RS' => array( // Serbian districts.
3765 'RS00' => _x('Belgrade', 'district', 'everest-forms'),
3766 'RS14' => _x('Bor', 'district', 'everest-forms'),
3767 'RS11' => _x('Braničevo', 'district', 'everest-forms'),
3768 'RS02' => _x('Central Banat', 'district', 'everest-forms'),
3769 'RS10' => _x('Danube', 'district', 'everest-forms'),
3770 'RS23' => _x('Jablanica', 'district', 'everest-forms'),
3771 'RS09' => _x('Kolubara', 'district', 'everest-forms'),
3772 'RS08' => _x('Mačva', 'district', 'everest-forms'),
3773 'RS17' => _x('Morava', 'district', 'everest-forms'),
3774 'RS20' => _x('Nišava', 'district', 'everest-forms'),
3775 'RS01' => _x('North Bačka', 'district', 'everest-forms'),
3776 'RS03' => _x('North Banat', 'district', 'everest-forms'),
3777 'RS24' => _x('Pčinja', 'district', 'everest-forms'),
3778 'RS22' => _x('Pirot', 'district', 'everest-forms'),
3779 'RS13' => _x('Pomoravlje', 'district', 'everest-forms'),
3780 'RS19' => _x('Rasina', 'district', 'everest-forms'),
3781 'RS18' => _x('Raška', 'district', 'everest-forms'),
3782 'RS06' => _x('South Bačka', 'district', 'everest-forms'),
3783 'RS04' => _x('South Banat', 'district', 'everest-forms'),
3784 'RS07' => _x('Srem', 'district', 'everest-forms'),
3785 'RS12' => _x('Šumadija', 'district', 'everest-forms'),
3786 'RS21' => _x('Toplica', 'district', 'everest-forms'),
3787 'RS05' => _x('West Bačka', 'district', 'everest-forms'),
3788 'RS15' => _x('Zaječar', 'district', 'everest-forms'),
3789 'RS16' => _x('Zlatibor', 'district', 'everest-forms'),
3790 'RS25' => _x('Kosovo', 'district', 'everest-forms'),
3791 'RS26' => _x('Peć', 'district', 'everest-forms'),
3792 'RS27' => _x('Prizren', 'district', 'everest-forms'),
3793 'RS28' => _x('Kosovska Mitrovica', 'district', 'everest-forms'),
3794 'RS29' => _x('Kosovo-Pomoravlje', 'district', 'everest-forms'),
3795 'RSKM' => _x('Kosovo-Metohija', 'district', 'everest-forms'),
3796 'RSVO' => _x('Vojvodina', 'district', 'everest-forms'),
3797 ),
3798 'SE' => array(),
3799 'UA' => array( // Ukrainian oblasts.
3800 'VN' => __('Vinnytsia Oblast', 'everest-forms'),
3801 'VL' => __('Volyn Oblast', 'everest-forms'),
3802 'DP' => __('Dnipropetrovsk Oblast', 'everest-forms'),
3803 'DT' => __('Donetsk Oblast', 'everest-forms'),
3804 'ZT' => __('Zhytomyr Oblast', 'everest-forms'),
3805 'ZK' => __('Zakarpattia Oblast', 'everest-forms'),
3806 'ZP' => __('Zaporizhzhia Oblast', 'everest-forms'),
3807 'IF' => __('Ivano-Frankivsk Oblast', 'everest-forms'),
3808 'KV' => __('Kyiv Oblast', 'everest-forms'),
3809 'KH' => __('Kirovohrad Oblast', 'everest-forms'),
3810 'LH' => __('Luhansk Oblast', 'everest-forms'),
3811 'LV' => __('Lviv Oblast', 'everest-forms'),
3812 'MY' => __('Mykolaiv Oblast', 'everest-forms'),
3813 'OD' => __('Odessa Oblast', 'everest-forms'),
3814 'PL' => __('Poltava Oblast', 'everest-forms'),
3815 'RV' => __('Rivne Oblast', 'everest-forms'),
3816 'SM' => __('Sumy Oblast', 'everest-forms'),
3817 'TP' => __('Ternopil Oblast', 'everest-forms'),
3818 'KK' => __('Kharkiv Oblast', 'everest-forms'),
3819 'KS' => __('Kherson Oblast', 'everest-forms'),
3820 'KM' => __('Khmelnytskyi Oblast', 'everest-forms'),
3821 'CK' => __('Cherkasy Oblast', 'everest-forms'),
3822 'CH' => __('Chernihiv Oblast', 'everest-forms'),
3823 'CV' => __('Chernivtsi Oblast', 'everest-forms'),
3824 ),
3825 'UG' => array( // Ugandan districts.
3826 'UG314' => __('Abim', 'everest-forms'),
3827 'UG301' => __('Adjumani', 'everest-forms'),
3828 'UG322' => __('Agago', 'everest-forms'),
3829 'UG323' => __('Alebtong', 'everest-forms'),
3830 'UG315' => __('Amolatar', 'everest-forms'),
3831 'UG324' => __('Amudat', 'everest-forms'),
3832 'UG216' => __('Amuria', 'everest-forms'),
3833 'UG316' => __('Amuru', 'everest-forms'),
3834 'UG302' => __('Apac', 'everest-forms'),
3835 'UG303' => __('Arua', 'everest-forms'),
3836 'UG217' => __('Budaka', 'everest-forms'),
3837 'UG218' => __('Bududa', 'everest-forms'),
3838 'UG201' => __('Bugiri', 'everest-forms'),
3839 'UG235' => __('Bugweri', 'everest-forms'),
3840 'UG420' => __('Buhweju', 'everest-forms'),
3841 'UG117' => __('Buikwe', 'everest-forms'),
3842 'UG219' => __('Bukedea', 'everest-forms'),
3843 'UG118' => __('Bukomansimbi', 'everest-forms'),
3844 'UG220' => __('Bukwa', 'everest-forms'),
3845 'UG225' => __('Bulambuli', 'everest-forms'),
3846 'UG416' => __('Buliisa', 'everest-forms'),
3847 'UG401' => __('Bundibugyo', 'everest-forms'),
3848 'UG430' => __('Bunyangabu', 'everest-forms'),
3849 'UG402' => __('Bushenyi', 'everest-forms'),
3850 'UG202' => __('Busia', 'everest-forms'),
3851 'UG221' => __('Butaleja', 'everest-forms'),
3852 'UG119' => __('Butambala', 'everest-forms'),
3853 'UG233' => __('Butebo', 'everest-forms'),
3854 'UG120' => __('Buvuma', 'everest-forms'),
3855 'UG226' => __('Buyende', 'everest-forms'),
3856 'UG317' => __('Dokolo', 'everest-forms'),
3857 'UG121' => __('Gomba', 'everest-forms'),
3858 'UG304' => __('Gulu', 'everest-forms'),
3859 'UG403' => __('Hoima', 'everest-forms'),
3860 'UG417' => __('Ibanda', 'everest-forms'),
3861 'UG203' => __('Iganga', 'everest-forms'),
3862 'UG418' => __('Isingiro', 'everest-forms'),
3863 'UG204' => __('Jinja', 'everest-forms'),
3864 'UG318' => __('Kaabong', 'everest-forms'),
3865 'UG404' => __('Kabale', 'everest-forms'),
3866 'UG405' => __('Kabarole', 'everest-forms'),
3867 'UG213' => __('Kaberamaido', 'everest-forms'),
3868 'UG427' => __('Kagadi', 'everest-forms'),
3869 'UG428' => __('Kakumiro', 'everest-forms'),
3870 'UG101' => __('Kalangala', 'everest-forms'),
3871 'UG222' => __('Kaliro', 'everest-forms'),
3872 'UG122' => __('Kalungu', 'everest-forms'),
3873 'UG102' => __('Kampala', 'everest-forms'),
3874 'UG205' => __('Kamuli', 'everest-forms'),
3875 'UG413' => __('Kamwenge', 'everest-forms'),
3876 'UG414' => __('Kanungu', 'everest-forms'),
3877 'UG206' => __('Kapchorwa', 'everest-forms'),
3878 'UG236' => __('Kapelebyong', 'everest-forms'),
3879 'UG126' => __('Kasanda', 'everest-forms'),
3880 'UG406' => __('Kasese', 'everest-forms'),
3881 'UG207' => __('Katakwi', 'everest-forms'),
3882 'UG112' => __('Kayunga', 'everest-forms'),
3883 'UG407' => __('Kibaale', 'everest-forms'),
3884 'UG103' => __('Kiboga', 'everest-forms'),
3885 'UG227' => __('Kibuku', 'everest-forms'),
3886 'UG432' => __('Kikuube', 'everest-forms'),
3887 'UG419' => __('Kiruhura', 'everest-forms'),
3888 'UG421' => __('Kiryandongo', 'everest-forms'),
3889 'UG408' => __('Kisoro', 'everest-forms'),
3890 'UG305' => __('Kitgum', 'everest-forms'),
3891 'UG319' => __('Koboko', 'everest-forms'),
3892 'UG325' => __('Kole', 'everest-forms'),
3893 'UG306' => __('Kotido', 'everest-forms'),
3894 'UG208' => __('Kumi', 'everest-forms'),
3895 'UG333' => __('Kwania', 'everest-forms'),
3896 'UG228' => __('Kween', 'everest-forms'),
3897 'UG123' => __('Kyankwanzi', 'everest-forms'),
3898 'UG422' => __('Kyegegwa', 'everest-forms'),
3899 'UG415' => __('Kyenjojo', 'everest-forms'),
3900 'UG125' => __('Kyotera', 'everest-forms'),
3901 'UG326' => __('Lamwo', 'everest-forms'),
3902 'UG307' => __('Lira', 'everest-forms'),
3903 'UG229' => __('Luuka', 'everest-forms'),
3904 'UG104' => __('Luwero', 'everest-forms'),
3905 'UG124' => __('Lwengo', 'everest-forms'),
3906 'UG114' => __('Lyantonde', 'everest-forms'),
3907 'UG223' => __('Manafwa', 'everest-forms'),
3908 'UG320' => __('Maracha', 'everest-forms'),
3909 'UG105' => __('Masaka', 'everest-forms'),
3910 'UG409' => __('Masindi', 'everest-forms'),
3911 'UG214' => __('Mayuge', 'everest-forms'),
3912 'UG209' => __('Mbale', 'everest-forms'),
3913 'UG410' => __('Mbarara', 'everest-forms'),
3914 'UG423' => __('Mitooma', 'everest-forms'),
3915 'UG115' => __('Mityana', 'everest-forms'),
3916 'UG308' => __('Moroto', 'everest-forms'),
3917 'UG309' => __('Moyo', 'everest-forms'),
3918 'UG106' => __('Mpigi', 'everest-forms'),
3919 'UG107' => __('Mubende', 'everest-forms'),
3920 'UG108' => __('Mukono', 'everest-forms'),
3921 'UG334' => __('Nabilatuk', 'everest-forms'),
3922 'UG311' => __('Nakapiripirit', 'everest-forms'),
3923 'UG116' => __('Nakaseke', 'everest-forms'),
3924 'UG109' => __('Nakasongola', 'everest-forms'),
3925 'UG230' => __('Namayingo', 'everest-forms'),
3926 'UG234' => __('Namisindwa', 'everest-forms'),
3927 'UG224' => __('Namutumba', 'everest-forms'),
3928 'UG327' => __('Napak', 'everest-forms'),
3929 'UG310' => __('Nebbi', 'everest-forms'),
3930 'UG231' => __('Ngora', 'everest-forms'),
3931 'UG424' => __('Ntoroko', 'everest-forms'),
3932 'UG411' => __('Ntungamo', 'everest-forms'),
3933 'UG328' => __('Nwoya', 'everest-forms'),
3934 'UG331' => __('Omoro', 'everest-forms'),
3935 'UG329' => __('Otuke', 'everest-forms'),
3936 'UG321' => __('Oyam', 'everest-forms'),
3937 'UG312' => __('Pader', 'everest-forms'),
3938 'UG332' => __('Pakwach', 'everest-forms'),
3939 'UG210' => __('Pallisa', 'everest-forms'),
3940 'UG110' => __('Rakai', 'everest-forms'),
3941 'UG429' => __('Rubanda', 'everest-forms'),
3942 'UG425' => __('Rubirizi', 'everest-forms'),
3943 'UG431' => __('Rukiga', 'everest-forms'),
3944 'UG412' => __('Rukungiri', 'everest-forms'),
3945 'UG111' => __('Sembabule', 'everest-forms'),
3946 'UG232' => __('Serere', 'everest-forms'),
3947 'UG426' => __('Sheema', 'everest-forms'),
3948 'UG215' => __('Sironko', 'everest-forms'),
3949 'UG211' => __('Soroti', 'everest-forms'),
3950 'UG212' => __('Tororo', 'everest-forms'),
3951 'UG113' => __('Wakiso', 'everest-forms'),
3952 'UG313' => __('Yumbe', 'everest-forms'),
3953 'UG330' => __('Zombo', 'everest-forms'),
3954 ),
3955 'UM' => array(
3956 '81' => __('Baker Island', 'everest-forms'),
3957 '84' => __('Howland Island', 'everest-forms'),
3958 '86' => __('Jarvis Island', 'everest-forms'),
3959 '67' => __('Johnston Atoll', 'everest-forms'),
3960 '89' => __('Kingman Reef', 'everest-forms'),
3961 '71' => __('Midway Atoll', 'everest-forms'),
3962 '76' => __('Navassa Island', 'everest-forms'),
3963 '95' => __('Palmyra Atoll', 'everest-forms'),
3964 '79' => __('Wake Island', 'everest-forms'),
3965 ),
3966 'US' => array( // U.S. states.
3967 'AL' => __('Alabama', 'everest-forms'),
3968 'AK' => __('Alaska', 'everest-forms'),
3969 'AZ' => __('Arizona', 'everest-forms'),
3970 'AR' => __('Arkansas', 'everest-forms'),
3971 'CA' => __('California', 'everest-forms'),
3972 'CO' => __('Colorado', 'everest-forms'),
3973 'CT' => __('Connecticut', 'everest-forms'),
3974 'DE' => __('Delaware', 'everest-forms'),
3975 'DC' => __('District Of Columbia', 'everest-forms'),
3976 'FL' => __('Florida', 'everest-forms'),
3977 'GA' => _x('Georgia', 'US state of Georgia', 'everest-forms'),
3978 'HI' => __('Hawaii', 'everest-forms'),
3979 'ID' => __('Idaho', 'everest-forms'),
3980 'IL' => __('Illinois', 'everest-forms'),
3981 'IN' => __('Indiana', 'everest-forms'),
3982 'IA' => __('Iowa', 'everest-forms'),
3983 'KS' => __('Kansas', 'everest-forms'),
3984 'KY' => __('Kentucky', 'everest-forms'),
3985 'LA' => __('Louisiana', 'everest-forms'),
3986 'ME' => __('Maine', 'everest-forms'),
3987 'MD' => __('Maryland', 'everest-forms'),
3988 'MA' => __('Massachusetts', 'everest-forms'),
3989 'MI' => __('Michigan', 'everest-forms'),
3990 'MN' => __('Minnesota', 'everest-forms'),
3991 'MS' => __('Mississippi', 'everest-forms'),
3992 'MO' => __('Missouri', 'everest-forms'),
3993 'MT' => __('Montana', 'everest-forms'),
3994 'NE' => __('Nebraska', 'everest-forms'),
3995 'NV' => __('Nevada', 'everest-forms'),
3996 'NH' => __('New Hampshire', 'everest-forms'),
3997 'NJ' => __('New Jersey', 'everest-forms'),
3998 'NM' => __('New Mexico', 'everest-forms'),
3999 'NY' => __('New York', 'everest-forms'),
4000 'NC' => __('North Carolina', 'everest-forms'),
4001 'ND' => __('North Dakota', 'everest-forms'),
4002 'OH' => __('Ohio', 'everest-forms'),
4003 'OK' => __('Oklahoma', 'everest-forms'),
4004 'OR' => __('Oregon', 'everest-forms'),
4005 'PA' => __('Pennsylvania', 'everest-forms'),
4006 'RI' => __('Rhode Island', 'everest-forms'),
4007 'SC' => __('South Carolina', 'everest-forms'),
4008 'SD' => __('South Dakota', 'everest-forms'),
4009 'TN' => __('Tennessee', 'everest-forms'),
4010 'TX' => __('Texas', 'everest-forms'),
4011 'UT' => __('Utah', 'everest-forms'),
4012 'VT' => __('Vermont', 'everest-forms'),
4013 'VA' => __('Virginia', 'everest-forms'),
4014 'WA' => __('Washington', 'everest-forms'),
4015 'WV' => __('West Virginia', 'everest-forms'),
4016 'WI' => __('Wisconsin', 'everest-forms'),
4017 'WY' => __('Wyoming', 'everest-forms'),
4018 'AA' => __('Armed Forces (AA)', 'everest-forms'),
4019 'AE' => __('Armed Forces (AE)', 'everest-forms'),
4020 'AP' => __('Armed Forces (AP)', 'everest-forms'),
4021 ),
4022 'UY' => array( // Uruguayan states.
4023 'UY-AR' => __('Artigas', 'everest-forms'),
4024 'UY-CA' => __('Canelones', 'everest-forms'),
4025 'UY-CL' => __('Cerro Largo', 'everest-forms'),
4026 'UY-CO' => __('Colonia', 'everest-forms'),
4027 'UY-DU' => __('Durazno', 'everest-forms'),
4028 'UY-FS' => __('Flores', 'everest-forms'),
4029 'UY-FD' => __('Florida', 'everest-forms'),
4030 'UY-LA' => __('Lavalleja', 'everest-forms'),
4031 'UY-MA' => __('Maldonado', 'everest-forms'),
4032 'UY-MO' => __('Montevideo', 'everest-forms'),
4033 'UY-PA' => __('Paysandú', 'everest-forms'),
4034 'UY-RN' => __('Río Negro', 'everest-forms'),
4035 'UY-RV' => __('Rivera', 'everest-forms'),
4036 'UY-RO' => __('Rocha', 'everest-forms'),
4037 'UY-SA' => __('Salto', 'everest-forms'),
4038 'UY-SJ' => __('San José', 'everest-forms'),
4039 'UY-SO' => __('Soriano', 'everest-forms'),
4040 'UY-TA' => __('Tacuarembó', 'everest-forms'),
4041 'UY-TT' => __('Treinta y Tres', 'everest-forms'),
4042 ),
4043 'VE' => array( // Venezuelan states.
4044 'VE-A' => __('Capital', 'everest-forms'),
4045 'VE-B' => __('Anzoátegui', 'everest-forms'),
4046 'VE-C' => __('Apure', 'everest-forms'),
4047 'VE-D' => __('Aragua', 'everest-forms'),
4048 'VE-E' => __('Barinas', 'everest-forms'),
4049 'VE-F' => __('Bolívar', 'everest-forms'),
4050 'VE-G' => __('Carabobo', 'everest-forms'),
4051 'VE-H' => __('Cojedes', 'everest-forms'),
4052 'VE-I' => __('Falcón', 'everest-forms'),
4053 'VE-J' => __('Guárico', 'everest-forms'),
4054 'VE-K' => __('Lara', 'everest-forms'),
4055 'VE-L' => __('Mérida', 'everest-forms'),
4056 'VE-M' => __('Miranda', 'everest-forms'),
4057 'VE-N' => __('Monagas', 'everest-forms'),
4058 'VE-O' => __('Nueva Esparta', 'everest-forms'),
4059 'VE-P' => __('Portuguesa', 'everest-forms'),
4060 'VE-R' => __('Sucre', 'everest-forms'),
4061 'VE-S' => __('Táchira', 'everest-forms'),
4062 'VE-T' => __('Trujillo', 'everest-forms'),
4063 'VE-U' => __('Yaracuy', 'everest-forms'),
4064 'VE-V' => __('Zulia', 'everest-forms'),
4065 'VE-W' => __('Federal Dependencies', 'everest-forms'),
4066 'VE-X' => __('La Guaira (Vargas)', 'everest-forms'),
4067 'VE-Y' => __('Delta Amacuro', 'everest-forms'),
4068 'VE-Z' => __('Amazonas', 'everest-forms'),
4069 ),
4070 'VN' => array(),
4071 'YT' => array(),
4072 'ZA' => array( // South African states.
4073 'EC' => __('Eastern Cape', 'everest-forms'),
4074 'FS' => __('Free State', 'everest-forms'),
4075 'GP' => __('Gauteng', 'everest-forms'),
4076 'KZN' => __('KwaZulu-Natal', 'everest-forms'),
4077 'LP' => __('Limpopo', 'everest-forms'),
4078 'MP' => __('Mpumalanga', 'everest-forms'),
4079 'NC' => __('Northern Cape', 'everest-forms'),
4080 'NW' => __('North West', 'everest-forms'),
4081 'WC' => __('Western Cape', 'everest-forms'),
4082 ),
4083 'ZM' => array( // Zambian provinces.
4084 'ZM-01' => __('Western', 'everest-forms'),
4085 'ZM-02' => __('Central', 'everest-forms'),
4086 'ZM-03' => __('Eastern', 'everest-forms'),
4087 'ZM-04' => __('Luapula', 'everest-forms'),
4088 'ZM-05' => __('Northern', 'everest-forms'),
4089 'ZM-06' => __('North-Western', 'everest-forms'),
4090 'ZM-07' => __('Southern', 'everest-forms'),
4091 'ZM-08' => __('Copperbelt', 'everest-forms'),
4092 'ZM-09' => __('Lusaka', 'everest-forms'),
4093 'ZM-10' => __('Muchinga', 'everest-forms'),
4094 ),
4095 );
4096
4097 return (array) apply_filters('everest_forms_states', $states);
4098 }
4099
4100 /**
4101 * Get builder fields groups.
4102 *
4103 * @return array
4104 */
4105 function evf_get_fields_groups()
4106 {
4107 return (array) apply_filters(
4108 'everest_forms_builder_fields_groups',
4109 array(
4110 'general' => __('General Fields', 'everest-forms'),
4111 'advanced' => __('Advanced Fields', 'everest-forms'),
4112 'payment' => __('Payment Fields', 'everest-forms'),
4113 'survey' => __('Survey Fields', 'everest-forms'),
4114 )
4115 );
4116 }
4117
4118 /**
4119 * Get a builder fields type's name.
4120 *
4121 * @param string $type Coupon type.
4122 * @return string
4123 */
4124 function evf_get_fields_group($type = '')
4125 {
4126 $types = evf_get_fields_groups();
4127 return isset($types[$type]) ? $types[$type] : '';
4128 }
4129
4130 /**
4131 * Determine whether a field type is "locked" for the current site.
4132 *
4133 * A locked field is a registered Pro/addon field that the user cannot
4134 * currently use (no license or required addon inactive). Locked fields are
4135 * shown in the builder for upsell (with all settings visible but not editable)
4136 * and are excluded from the published form until unlocked. The state is
4137 * derived, never stored, so fields auto-unlock once the addon/license becomes
4138 * available - no data migration required.
4139 *
4140 * @since 3.2.0
4141 *
4142 * @param string $type Field type slug (e.g. 'signature').
4143 * @return bool True when the field type is locked.
4144 */
4145 function evf_is_field_locked($type)
4146 {
4147 $locked = in_array($type, evf()->form_fields->get_pro_form_field_types(), true);
4148
4149 /**
4150 * Filter whether a given field type is locked.
4151 *
4152 * @since 3.2.0
4153 *
4154 * @param bool $locked Whether the field type is locked.
4155 * @param string $type Field type slug.
4156 */
4157 return (bool) apply_filters('everest_forms_is_field_locked', $locked, $type);
4158 }
4159
4160 /**
4161 * Return the addon slug required by a field if that addon is currently inactive.
4162 *
4163 * This covers a gap that evf_is_field_locked() cannot: when EVF Pro is active it
4164 * registers the full field class (without is_pro), so the field is no longer
4165 * plan-locked — but the specific addon the field depends on (e.g. Stripe for the
4166 * credit-card field) may not be installed. In that case the builder preview renders
4167 * blank, giving the user no feedback. This function detects that state so the
4168 * builder can show the ADD-ON badge and a proper "Activate add-on" CTA.
4169 *
4170 * @since 3.4.6
4171 *
4172 * @param string $type Field type slug (e.g. 'credit-card').
4173 * @return string Addon slug (e.g. 'everest-forms-stripe') when the field needs an
4174 * inactive addon, or empty string when no addon is required / addon
4175 * is already active.
4176 */
4177 function evf_field_inactive_addon( $type ) {
4178 // Pro/addons declare field→addon dependencies here when the field class
4179 // itself doesn't register while the addon is absent (e.g. credit-card
4180 // requires Stripe, but the class bails in its constructor when Stripe is
4181 // inactive, so it never appears in form_fields()).
4182 $requirements = apply_filters( 'everest_forms_field_addon_requirements', array() );
4183 if ( isset( $requirements[ $type ] ) ) {
4184 $addon = $requirements[ $type ];
4185 $plugin_file = $addon . '/' . $addon . '.php';
4186 return is_plugin_active( $plugin_file ) ? '' : $addon;
4187 }
4188
4189 // Fallback: field registered itself in the registry with an addon property.
4190 foreach ( evf()->form_fields->form_fields() as $group ) {
4191 foreach ( $group as $field_obj ) {
4192 if ( $field_obj->type === $type ) {
4193 if ( empty( $field_obj->addon ) ) {
4194 return '';
4195 }
4196 $plugin_file = $field_obj->addon . '/' . $field_obj->addon . '.php';
4197 return is_plugin_active( $plugin_file ) ? '' : $field_obj->addon;
4198 }
4199 }
4200 }
4201 return '';
4202 }
4203
4204 /**
4205 * Get all fields settings.
4206 *
4207 * @return array Settings data.
4208 */
4209 function evf_get_all_fields_settings()
4210 {
4211 $settings = array(
4212 'label' => array(
4213 'id' => 'label',
4214 'title' => __('Label', 'everest-forms'),
4215 'desc' => __('Enter text for the form field label. This is recommended and can be hidden in the Advanced Settings.', 'everest-forms'),
4216 'default' => '',
4217 'type' => 'text',
4218 'desc_tip' => true,
4219 ),
4220 'meta' => array(
4221 'id' => 'meta-key',
4222 'title' => __('Meta Key', 'everest-forms'),
4223 'desc' => __('Enter meta key to be stored in database.', 'everest-forms'),
4224 'default' => '',
4225 'type' => 'text',
4226 'desc_tip' => true,
4227 ),
4228 'description' => array(
4229 'id' => 'description',
4230 'title' => __('Description', 'everest-forms'),
4231 'type' => 'textarea',
4232 'desc' => __('Enter text for the form field description.', 'everest-forms'),
4233 'default' => '',
4234 'desc_tip' => true,
4235 ),
4236 'required' => array(
4237 'id' => 'require',
4238 'title' => __('Required', 'everest-forms'),
4239 'type' => 'checkbox',
4240 'desc' => __('Check this option to mark the field required.', 'everest-forms'),
4241 'default' => 'no',
4242 'desc_tip' => true,
4243 ),
4244 'choices' => array(
4245 'id' => 'choices',
4246 'title' => __('Choices', 'everest-forms'),
4247 'desc' => __('Add choices for the form field.', 'everest-forms'),
4248 'type' => 'choices',
4249 'desc_tip' => true,
4250 'defaults' => array(
4251 1 => __('First Choice', 'everest-forms'),
4252 2 => __('Second Choice', 'everest-forms'),
4253 3 => __('Third Choice', 'everest-forms'),
4254 ),
4255 ),
4256 'placeholder' => array(
4257 'id' => 'placeholder',
4258 'title' => __('Placeholder Text', 'everest-forms'),
4259 'desc' => __('Enter text for the form field placeholder.', 'everest-forms'),
4260 'default' => '',
4261 'type' => 'text',
4262 'desc_tip' => true,
4263 ),
4264 'css' => array(
4265 'id' => 'css',
4266 'title' => __('CSS Classes', 'everest-forms'),
4267 'desc' => __('Enter CSS class for this field container. Class names should be separated with spaces.', 'everest-forms'),
4268 'default' => '',
4269 'type' => 'text',
4270 'desc_tip' => true,
4271 ),
4272 'label_hide' => array(
4273 'id' => 'label_hide',
4274 'title' => __('Hide Label', 'everest-forms'),
4275 'type' => 'checkbox',
4276 'desc' => __('Check this option to hide the form field label.', 'everest-forms'),
4277 'default' => 'no',
4278 'desc_tip' => true,
4279 ),
4280 'sublabel_hide' => array(
4281 'id' => 'sublabel_hide',
4282 'title' => __('Hide Sub-Labels', 'everest-forms'),
4283 'type' => 'checkbox',
4284 'desc' => __('Check this option to hide the form field sub-label.', 'everest-forms'),
4285 'default' => 'no',
4286 'desc_tip' => true,
4287 ),
4288 );
4289
4290 return apply_filters('everest_form_all_fields_settings', $settings);
4291 }
4292
4293 /**
4294 * Helper function to display debug data.
4295 *
4296 * @since 1.3.2
4297 *
4298 * @param mixed $expression The expression to be printed.
4299 * @param bool $return Optional. Default false. Set to true to return the human-readable string.
4300 *
4301 * @return string
4302 */
4303 function evf_debug_data($expression, $return = false)
4304 {
4305 if (defined('EVF_DEBUG') && true === EVF_DEBUG) {
4306
4307 if (! $return) {
4308 echo '<textarea style="color:#666;background:#fff;margin: 20px 0;width:100%;height:500px;font-size:12px;font-family: Consolas,Monaco,Lucida Console,monospace;direction: ltr;unicode-bidi: embed;line-height: 1.4;padding: 4px 6px 1px;" readonly>';
4309
4310 echo "==================== Everest Forms Debugging ====================\n\n";
4311
4312 if (is_array($expression) || is_object($expression)) {
4313 echo esc_html(evf_print_r($expression, true));
4314 } else {
4315 echo esc_html($expression);
4316 }
4317 echo '</textarea>';
4318 } else {
4319 $output = '<textarea style="color:#666;background:#fff;margin: 20px 0;width:100%;height:500px;font-size:12px;font-family: Consolas,Monaco,Lucida Console,monospace;direction: ltr;unicode-bidi: embed;line-height: 1.4;padding: 4px 6px 1px;" readonly>';
4320
4321 $output .= "==================== Everest Forms Debugging ====================\n\n";
4322
4323 if (is_array($expression) || is_object($expression)) {
4324 $output .= evf_print_r($expression, true);
4325 } else {
4326 $output .= $expression;
4327 }
4328
4329 $output .= '</textarea>';
4330
4331 return $output;
4332 }
4333 }
4334 }
4335
4336 /**
4337 * String translation function.
4338 *
4339 * @since 1.4.9
4340 *
4341 * @param int $form_id Form ID.
4342 * @param string $field_id Field ID.
4343 * @param mixed $value The string that needs to be translated.
4344 * @param string $suffix The suffix to make the field have unique naem.
4345 *
4346 * @return mixed The translated string.
4347 */
4348 function evf_string_translation($form_id, $field_id, $value, $suffix = '')
4349 {
4350 $context = isset($form_id) ? 'everest_forms_' . absint($form_id) : 0;
4351 $name = isset($field_id) ? evf_clean($field_id . $suffix) : '';
4352
4353 if (function_exists('icl_register_string')) {
4354 icl_register_string($context, $name, $value);
4355 }
4356
4357 if (function_exists('icl_t')) {
4358 $value = icl_t($context, $name, $value);
4359 }
4360
4361 return $value;
4362 }
4363
4364 /**
4365 * Trigger logging cleanup using the logging class.
4366 *
4367 * @since 1.6.2
4368 */
4369 function evf_cleanup_logs()
4370 {
4371 $logger = evf_get_logger();
4372
4373 if (is_callable(array($logger, 'clear_expired_logs'))) {
4374 $logger->clear_expired_logs();
4375 }
4376 }
4377 add_action('everest_forms_cleanup_logs', 'evf_cleanup_logs');
4378
4379
4380 /**
4381 * Check whether it device is table or not from HTTP user agent
4382 *
4383 * @since 1.7.0
4384 *
4385 * @return bool
4386 */
4387 function evf_is_tablet()
4388 {
4389 return false !== stripos(evf_get_user_agent(), 'tablet') || false !== stripos(evf_get_user_agent(), 'tab');
4390 }
4391
4392 /**
4393 * Get user device from user agent from HTTP user agent.
4394 *
4395 * @since 1.7.0
4396 *
4397 * @return string
4398 */
4399 function evf_get_user_device()
4400 {
4401 if (evf_is_tablet()) {
4402 return esc_html__('Tablet', 'everest-forms');
4403 } elseif (wp_is_mobile()) {
4404 return esc_html__('Mobile', 'everest-forms');
4405 } else {
4406 return esc_html__('Desktop', 'everest-forms');
4407 }
4408 }
4409
4410
4411 /**
4412 * A wp_parse_args() for multi-dimensional array.
4413 *
4414 * @see https://developer.wordpress.org/reference/functions/wp_parse_args/
4415 *
4416 * @since 1.7.0
4417 *
4418 * @param array $args Value to merge with $defaults.
4419 * @param array $defaults Array that serves as the defaults.
4420 *
4421 * @return array Merged user defined values with defaults.
4422 */
4423 function evf_parse_args(&$args, $defaults)
4424 {
4425 $args = (array) $args;
4426 $defaults = (array) $defaults;
4427 $result = $defaults;
4428 foreach ($args as $k => &$v) {
4429 if (is_array($v) && isset($result[$k])) {
4430 $result[$k] = evf_parse_args($v, $result[$k]);
4431 } else {
4432 $result[$k] = $v;
4433 }
4434 }
4435 return $result;
4436 }
4437
4438 /**
4439 * Get date of ranges.
4440 *
4441 * @since 1.7.0
4442 *
4443 * @param string $first Starting date.
4444 * @param string $last End date.
4445 * @param string $step Date step.
4446 * @param string $format Date format.
4447 *
4448 * @return array Range dates.
4449 */
4450 function evf_date_range($first, $last = '', $step = '+1 day', $format = 'Y/m/d')
4451 {
4452 $dates = array();
4453 $current = strtotime($first);
4454 $last = strtotime($last);
4455
4456 while ($current <= $last) {
4457 $dates[] = date_i18n($format, $current);
4458 $current = strtotime($step, $current);
4459 }
4460
4461 return $dates;
4462 }
4463
4464 /**
4465 * Process syntaxes in a text.
4466 *
4467 * @since 1.7.0
4468 *
4469 * @param string $text Text to be processed.
4470 * @param bool $escape_html Whether to escape all the htmls before processing or not.
4471 * @param bool $trim_trailing_spaces Whether to trim trailing spaces or not.
4472 *
4473 * @return string Processed text.
4474 */
4475 function evf_process_syntaxes($text, $escape_html = true, $trim_trailing_spaces = true)
4476 {
4477
4478 if (true === $trim_trailing_spaces) {
4479 $text = trim($text);
4480 }
4481 if (true === $escape_html) {
4482 $text = esc_html($text);
4483 }
4484 $text = evf_process_hyperlink_syntax($text);
4485 $text = evf_process_italic_syntax($text);
4486 $text = evf_process_bold_syntax($text);
4487 $text = evf_process_underline_syntax($text);
4488 $text = evf_process_line_breaks($text);
4489 return $text;
4490 }
4491
4492 /**
4493 * Extract page ids from a text.
4494 *
4495 * @since 1.7.0
4496 *
4497 * @param string $text Text to extract page ids from.
4498 *
4499 * @return mixed
4500 */
4501 function evf_extract_page_ids($text)
4502 {
4503 $page_id_syntax_matches = array();
4504 $page_ids = array();
4505
4506 while (preg_match('/page_id=([0-9]+)/', $text, $page_id_syntax_matches)) {
4507 $page_id = $page_id_syntax_matches[1];
4508 $page_ids[] = $page_id;
4509 $text = str_replace('page_id=' . $page_id, '', $text);
4510 }
4511
4512 if (count($page_ids) > 0) {
4513 return $page_ids;
4514 }
4515 return false;
4516 }
4517
4518 /**
4519 * Process hyperlink syntaxes in a text.
4520 * The syntax used for hyperlink is: [Link Label](Link URL)
4521 * Example: [Google Search Page](https://google.com)
4522 *
4523 * @since 1.7.0
4524 *
4525 * @param string $text Text to process.
4526 * @param string $use_no_a_tag If set to `true` only the link will be used and no `a` tag. Particularly useful for exporting CSV,
4527 * as the html tags are escaped in a CSV file.
4528 *
4529 * @return string Processed text.
4530 */
4531 function evf_process_hyperlink_syntax($text, $use_no_a_tag = false)
4532 {
4533 $matches = array();
4534 $regex = '/(\[[^\[\]]*\])(\([^\(\)]*\))/';
4535
4536 while (preg_match($regex, $text, $matches)) {
4537 $matched_string = $matches[0];
4538 $label = $matches[1];
4539 $link = $matches[2];
4540 $class = '';
4541 $page_id = '';
4542
4543 // Trim brackets.
4544 $label = trim(substr($label, 1, -1));
4545 $link = trim(substr($link, 1, -1));
4546
4547 // Proceed only if label or link is not empty.
4548 if (! empty($label) || ! empty($link)) {
4549
4550 // Use hash(#) if the link is empty.
4551 if (empty($link)) {
4552 $link = '#';
4553 }
4554
4555 // Use link as label if it's empty.
4556 if (empty($label)) {
4557 $label = $link;
4558 }
4559
4560 // See if it's a link to a local page.
4561 if (strpos($link, '?') === 0) {
4562 $class .= ' evf-privacy-policy-local-page-link';
4563
4564 // Extract page id.
4565 $page_ids = evf_extract_page_ids($link);
4566
4567 if (false !== $page_ids) {
4568 $page_id = $page_ids[0];
4569 $link = get_page_link($page_id);
4570
4571 if (empty($link)) {
4572 $link = '#';
4573 }
4574 }
4575 }
4576
4577 // Insert hyperlink html.
4578 if (true === $use_no_a_tag) {
4579 $html = $link;
4580 } else {
4581 $html = sprintf('<a data-page-id="%s" target="_blank" rel="noopener noreferrer nofollow" href="%s" class="%s">%s</a>', $page_id, $link, $class, $label);
4582 }
4583 $text = str_replace($matched_string, $html, $text);
4584 } else {
4585 // If both label and link are empty then replace it with empty string.
4586 $text = str_replace($matched_string, '', $text);
4587 }
4588 }
4589
4590 return $text;
4591 }
4592
4593 /**
4594 * Process italic syntaxes in a text.
4595 * The syntax used for italic text is: `text`
4596 * Just wrap the text with back tick characters. To escape a backtick insert a backslash(\) before the character like "\`".
4597 *
4598 * @since 1.7.0
4599 *
4600 * @param string $text Text to process.
4601 *
4602 * @return string Processed text.
4603 */
4604 function evf_process_italic_syntax($text)
4605 {
4606 $matches = array();
4607 $regex = '/`[^`]+`/';
4608 $text = str_replace('\`', '<&&&&&>', $text); // To preserve an escaped special character '`'.
4609
4610 while (preg_match($regex, $text, $matches)) {
4611 $matched_string = $matches[0];
4612 $label = substr(trim($matched_string), 1, -1);
4613 $html = sprintf('<i>%s</i>', $label);
4614 $text = str_replace($matched_string, $html, $text);
4615 }
4616
4617 return str_replace('<&&&&&>', '`', $text);
4618 }
4619
4620 /**
4621 * Process bold syntaxes in a text.
4622 * The syntax used for bold text is: *text*
4623 * Just wrap the text with asterisk characters. To escape an asterisk insert a backslash(\) before the character like "\*".
4624 *
4625 * @since 1.7.0
4626 *
4627 * @param string $text Text to process.
4628 *
4629 * @return string Processed text.
4630 */
4631 function evf_process_bold_syntax($text)
4632 {
4633 $matches = array();
4634 $regex = '/\*[^*]+\*/';
4635 $text = str_replace('\*', '<&&&&&>', $text); // To preserve an escaped special character '*'.
4636
4637 while (preg_match($regex, $text, $matches)) {
4638 $matched_string = $matches[0];
4639 $label = substr(trim($matched_string), 1, -1);
4640 $html = sprintf('<b>%s</b>', $label);
4641 $text = str_replace($matched_string, $html, $text);
4642 }
4643
4644 return str_replace('<&&&&&>', '*', $text);
4645 }
4646
4647 /**
4648 * Process underline syntaxes in a text.
4649 * The syntax used for bold text is: __text__
4650 * Wrap the text with double underscore characters. To escape an underscore insert a backslash(\) before the character like "\_".
4651 *
4652 * @since 1.7.0
4653 *
4654 * @param string $text Text to process.
4655 *
4656 * @return string Processed text.
4657 */
4658 function evf_process_underline_syntax($text)
4659 {
4660 $matches = array();
4661 $regex = '/__[^_]+__/';
4662 $text = str_replace('\_', '<&&&&&>', $text); // To preserve an escaped special character '_'.
4663
4664 while (preg_match($regex, $text, $matches)) {
4665 $matched_string = $matches[0];
4666 $label = substr(trim($matched_string), 2, -2);
4667 $html = sprintf('<u>%s</u>', $label);
4668 $text = str_replace($matched_string, $html, $text);
4669 }
4670
4671 $text = str_replace('<&&&&&>', '_', $text);
4672 return $text;
4673 }
4674
4675 /**
4676 * It replaces `\n` characters with `<br/>` tag because new line `\n` character is not supported in html.
4677 *
4678 * @since 1.7.0
4679 *
4680 * @param string $text Text to process.
4681 *
4682 * @return string Processed text.
4683 */
4684 function evf_process_line_breaks($text)
4685 {
4686 return str_replace("\n", '<br/>', $text);
4687 }
4688
4689 /**
4690 * Check whether the current page is in AMP mode or not.
4691 * We need to check for specific functions, as there is no special AMP header.
4692 *
4693 * @since 1.8.4
4694 *
4695 * @param bool $check_theme_support Whether theme support should be checked. Defaults to true.
4696 *
4697 * @return bool
4698 */
4699 function evf_is_amp($check_theme_support = true)
4700 {
4701
4702 $is_amp = false;
4703
4704 if (
4705 // AMP by Automattic.
4706 (function_exists('amp_is_request') && amp_is_request()) ||
4707 // Better AMP.
4708 (function_exists('is_better_amp') && is_better_amp())
4709 ) {
4710 $is_amp = true;
4711 }
4712
4713 if ($is_amp && $check_theme_support) {
4714 $is_amp = current_theme_supports('amp');
4715 }
4716
4717 return apply_filters('evf_is_amp', $is_amp);
4718 }
4719
4720 /**
4721 * EVF KSES.
4722 *
4723 * @since 1.8.2.1
4724 *
4725 * @param string $context Context.
4726 */
4727 function evf_get_allowed_html_tags($context = '')
4728 {
4729
4730 $post_tags = wp_kses_allowed_html('post');
4731 if ('builder' === $context) {
4732 $builder_tags = get_transient('evf-builder-tags-list');
4733 if (! empty($builder_tags)) {
4734 return $builder_tags;
4735 }
4736 $allowed_tags = evf_get_json_file_contents('assets/allowed_tags/allowed_tags.json', true);
4737 if (! empty($allowed_tags)) {
4738 foreach ($allowed_tags as $tag => $args) {
4739 if (array_key_exists($tag, $post_tags)) {
4740 foreach ($args as $arg => $value) {
4741 if (! array_key_exists($arg, $post_tags[$tag])) {
4742 $post_tags[$tag][$arg] = true;
4743 }
4744 }
4745 } else {
4746 $post_tags[$tag] = $args;
4747 }
4748 }
4749 set_transient('evf-builder-tags-list', $post_tags, DAY_IN_SECONDS);
4750 }
4751 return $post_tags;
4752 }
4753
4754 return wp_parse_args(
4755 $post_tags,
4756 array(
4757 'input' => array(
4758 'type' => true,
4759 'name' => true,
4760 'value' => true,
4761 ),
4762 'select' => array(
4763 'name' => true,
4764 'id' => true,
4765 ),
4766 'option' => array(
4767 'value' => true,
4768 'selected' => true,
4769 ),
4770 'textarea' => array(
4771 'style' => true,
4772 ),
4773 )
4774 );
4775 }
4776
4777 /**
4778 * Parse Builder Post Data.
4779 *
4780 * @param mixed $post_data Post Data.
4781 *
4782 * @since 1.8.2.2
4783 */
4784 function evf_sanitize_builder($post_data = array())
4785 {
4786
4787 if (empty($post_data) || ! is_array($post_data)) {
4788 return array();
4789 }
4790
4791 $form_data = array();
4792 foreach ( $post_data as $data_key => $data ) {
4793 $name = sanitize_text_field( $data->name );
4794 if ( preg_match( '/\<.*\>/', $data->value ) ) {
4795 $value = wp_kses_post( $data->value );
4796 } elseif ( 'settings[external_url]' === $data->name ) {
4797 $value = esc_url_raw( $data->value );
4798 } elseif ( preg_match( '/evf_email_message/', $data->name ) || preg_match( '/telegram_message/', $data->name ) || preg_match( '/slack_message/', $data->name ) ) {
4799 $value = wp_kses_post( $data->value );
4800 } elseif ( preg_match( '/calculation_field/', $data->name ) ) {
4801 $value = wp_kses_post( $data->value );
4802 } elseif ( preg_match( '/successful_form_submission_message/', $data->name ) ) {
4803 $value = wp_kses_post( $data->value );
4804 } elseif ( preg_match( '/meta-key/', $data->name ) ) {
4805 $value = sanitize_key( $data->value );
4806 } else {
4807 $value = sanitize_text_field($data->value);
4808 }
4809
4810 $form_data[sanitize_text_field($data_key)] = (object) array(
4811 'name' => $name,
4812 'value' => $value,
4813 );
4814 }
4815 return $form_data;
4816 }
4817
4818 /**
4819 * Entry Post Data.
4820 *
4821 * @param mixed $entry Post Data.
4822 *
4823 * @since 1.8.2.2
4824 */
4825 function evf_sanitize_entry($entry = array())
4826 {
4827 if (empty($entry) || ! is_array($entry) || empty($entry['form_fields'])) {
4828 return $entry;
4829 }
4830
4831 $form_id = absint($entry['id']);
4832 $form_data = evf()->form->get($form_id, array('contents_only' => true));
4833
4834 if (! $form_data) {
4835 return array();
4836 }
4837
4838 $form_data = evf_decode($form_data->post_content);
4839
4840 $form_fields = $form_data['form_fields'];
4841
4842 if (empty($form_fields)) {
4843 return array();
4844 }
4845
4846 foreach ($form_fields as $key => $field) {
4847 $key = sanitize_text_field($key);
4848 if (array_key_exists($key, $entry['form_fields'])) {
4849 switch ($field['type']) {
4850 case 'email':
4851 if (isset($entry['form_fields'][$key]['primary'])) {
4852 $entry['form_fields'][$key]['primary'] = sanitize_email($entry['form_fields'][$key]['primary']);
4853 $entry['form_fields'][$key]['secondary'] = sanitize_email($entry['form_fields'][$key]['secondary']);
4854 } else {
4855 $entry['form_fields'][$key] = sanitize_email($entry['form_fields'][$key]);
4856 }
4857 break;
4858 case 'file-upload':
4859 case 'signature':
4860 case 'image-upload':
4861 if ( is_array( $entry['form_fields'][ $key ] ) ) {
4862 $entry['form_fields'][ $key ] = array();
4863 } else {
4864 $entry['form_fields'][ $key ] = esc_url_raw( $entry['form_fields'][ $key ] );
4865 }
4866 break;
4867 case 'textarea':
4868 case 'html':
4869 case 'privacy-policy':
4870 case 'wysiwug':
4871 $entry['form_fields'][$key] = wp_kses_post($entry['form_fields'][$key]);
4872 break;
4873 case 'repeater-fields':
4874 $entry['form_fields'][$key] = $entry['form_fields'][$key];
4875 break;
4876 default:
4877 if (is_array($entry['form_fields'][$key])) {
4878 foreach ($entry['form_fields'][$key] as $field_key => $value) {
4879 $field_key = sanitize_text_field($field_key);
4880 $entry['form_fields'][$key][$field_key] = sanitize_text_field($value);
4881 }
4882 } else {
4883 $entry['form_fields'][$key] = sanitize_text_field($entry['form_fields'][$key]);
4884 }
4885 }
4886 }
4887 return $entry;
4888 }
4889 }
4890
4891 /**
4892 * EVF Get json file contents.
4893 *
4894 * @param mixed $file File path.
4895 * @param mixed $to_array Returned data in array.
4896 */
4897 function evf_get_json_file_contents($file, $to_array = false)
4898 {
4899 if ($to_array) {
4900 return json_decode(evf_file_get_contents($file), true);
4901 }
4902 return json_decode(evf_file_get_contents($file));
4903 }
4904
4905 /**
4906 * EVF file get contents.
4907 *
4908 * @param mixed $file File path.
4909 */
4910 function evf_file_get_contents($file)
4911 {
4912 if ($file) {
4913 $local_file = preg_replace('/\\\\|\/\//', '/', plugin_dir_path(EVF_PLUGIN_FILE) . $file);
4914 $response = file_get_contents($local_file);
4915 if ($response) {
4916 return $response;
4917 }
4918 global $wp_filesystem;
4919 require_once ABSPATH . '/wp-admin/includes/file.php';
4920 WP_Filesystem();
4921 $local_file = preg_replace('/\\\\|\/\//', '/', plugin_dir_path(EVF_PLUGIN_FILE) . $file);
4922 if ($wp_filesystem->exists($local_file)) {
4923 $response = $wp_filesystem->get_contents($local_file);
4924 return $response;
4925 }
4926 }
4927 return;
4928 }
4929
4930 /**
4931 * Parses datetime values based on the provided format and mode.
4932 *
4933 * @param string $datetime_value The datetime value to parse.
4934 * @param string $datetime_format The format of the datetime value.
4935 * @param string $date_format The format of the date.
4936 * @param string $mode The mode of the datetime field.
4937 * @param int $time_interval The time interval in minutes.
4938 * @param int $entry_id The entry id.
4939 * @return array
4940 */
4941 function parse_datetime_values($datetime_value, $datetime_format, $date_format, $mode, $time_interval, $entry_id = 0)
4942 {
4943 $datetime_arr = array();
4944
4945 switch ($datetime_format) {
4946 case 'time':
4947 $current_date = gmdate('Y-m-d');
4948 $datetime_value = gmdate('H:i', strtotime($datetime_value));
4949 $datetime_start = "$current_date $datetime_value";
4950 $date_time = new DateTime($datetime_start);
4951 $date_time->modify("+$time_interval minute");
4952 $datetime_end = $date_time->format('Y-m-d H:i');
4953 $datetime_arr[$entry_id] = array($datetime_start, $datetime_end);
4954 break;
4955 case 'date':
4956 if ('range' === $mode) {
4957 $datetime_value = apply_filters('everest_forms_time_date_format', $datetime_value);
4958 $selected_dates = explode(' to ', $datetime_value);
4959 if (count($selected_dates) >= 2) {
4960 if (count($selected_dates) >= 2) {
4961 $start_date = DateTime::createFromFormat($date_format, $selected_dates[0]);
4962 if ($start_date === false) {
4963 evf_get_logger()->debug(print_r("Invalid start date format: {$selected_dates[0]}", true));
4964 }
4965 $start_date->setTime(0, 0);
4966 $datetime_start = $start_date->format('Y-m-d H:i');
4967
4968 $end_date = DateTime::createFromFormat($date_format, $selected_dates[1]);
4969 if ($end_date === false) {
4970 evf_get_logger()->debug(print_r("Invalid end date format: {$selected_dates[1]}", true));
4971 }
4972 $end_date->modify('+23 hours');
4973 $datetime_end = $end_date->format('Y-m-d H:i');
4974
4975 $datetime_arr[$entry_id] = array($datetime_start, $datetime_end);
4976 }
4977 } else {
4978 if (!empty($datetime_value) && ! is_array($datetime_value)) {
4979 $datetime_arr[$entry_id] = $datetime_value;
4980 }
4981 }
4982 } else {
4983 $selected_dates = explode(', ', $datetime_value);
4984
4985 foreach ($selected_dates as $selected_date) {
4986 $datetime_start = "$selected_date 00:00";
4987 $datetime_start = gmdate('Y-m-d H:i', strtotime($datetime_start));
4988 $date_time = new DateTime($datetime_start);
4989 $date_time->modify('+23 hour');
4990
4991 $datetime_end = $date_time->format('Y-m-d H:i');
4992 $datetime_arr[$entry_id] = array($datetime_start, $datetime_end);
4993 }
4994 }
4995 break;
4996 case 'date-time':
4997 if ('range' === $mode) {
4998 $datetime_value = apply_filters('everest_forms_time_date_format', $datetime_value);
4999 $selected_dates = explode(' to ', $datetime_value);
5000 if (count($selected_dates) >= 2) {
5001 $datetime_start = gmdate('Y-m-d H:i', strtotime($selected_dates[0]));
5002 $datetime_end = gmdate('Y-m-d H:i', strtotime($selected_dates[1]));
5003 $datetime_arr[$entry_id] = array($datetime_start, $datetime_end);
5004 }
5005 } else {
5006 $selected_dates = explode(', ', $datetime_value);
5007
5008 foreach ($selected_dates as $selected_date) {
5009 $datetime_start = gmdate('Y-m-d H:i', strtotime($selected_date));
5010 $date_time = new DateTime($datetime_start);
5011 $date_time->modify("+$time_interval minute");
5012 $datetime_end = $date_time->format('Y-m-d H:i');
5013 $datetime_arr[$entry_id] = array($datetime_start, $datetime_end);
5014 }
5015 }
5016 break;
5017 }
5018
5019 return $datetime_arr;
5020 }
5021
5022 /**
5023 * EVF word Count.
5024 *
5025 * @param string $text Text.
5026 * @param string $type Type of text.
5027 * @param array $settings Settings.
5028 *
5029 * @since 2.0.2
5030 */
5031 function _evf_word_count($text, $type = 'words', $settings = array())
5032 {
5033 $defaults = array(
5034 'html_regexp' => '/<\/?[a-z][^>]*?>/i',
5035 'html_comment_regexp' => '/<!--[\s\S]*?-->/',
5036 'space_regexp' => '/&nbsp;|&#160;/i',
5037 'html_entity_regexp' => '/&\S+?;/',
5038 'connector_regexp' => "/--|\x{2014}/u",
5039 'remove_regexp' => "/[\x{0021}-\x{0040}\x{005B}-\x{0060}\x{007B}-\x{007E}\x{0080}-\x{00BF}\x{00D7}\x{00F7}\x{2000}-\x{2BFF}\x{2E00}-\x{2E7F}]/u",
5040 'astral_regexp' => "/[\x{010000}-\x{10FFFF}]/u",
5041 'words_regexp' => '/\S\s+/u',
5042 'characters_excluding_spaces_regexp' => '/\S/u',
5043 'characters_including_spaces_regexp' => "/[^\f\n\r\t\v\x{00AD}\x{2028}\x{2029}]/u",
5044 'shortcodes' => array(),
5045 );
5046
5047 $count = 0;
5048
5049 if ('' === trim($text)) {
5050 return $count;
5051 }
5052
5053 $settings = wp_parse_args($settings, $defaults);
5054
5055 // If there are any shortcodes, add this as a shortcode regular expression.
5056 if (is_array($settings['shortcodes']) && ! empty($settings['shortcodes'])) {
5057 $settings['shortcodes_regexp'] = '/\\[\\/?(?:' . implode('|', $settings['shortcodes']) . ')[^\\]]*?\\]/';
5058 }
5059
5060 // Sanitize type to one of three possibilities: 'words', 'characters_excluding_spaces' or 'characters_including_spaces'.
5061 if ('characters_excluding_spaces' !== $type && 'characters_including_spaces' !== $type) {
5062 $type = 'words';
5063 }
5064
5065 $text .= "\n";
5066
5067 // Replace all HTML with a new-line.
5068 $text = preg_replace($settings['html_regexp'], "\n", $text);
5069
5070 // Remove all HTML comments.
5071 $text = preg_replace($settings['html_comment_regexp'], '', $text);
5072
5073 // If a shortcode regular expression has been provided use it to remove shortcodes.
5074 if (! empty($settings['shortcodes_regexp'])) {
5075 $text = preg_replace($settings['shortcodes_regexp'], "\n", $text);
5076 }
5077
5078 // Normalize non-breaking space to a normal space.
5079 $text = preg_replace($settings['space_regexp'], ' ', $text);
5080
5081 if ('words' === $type) {
5082 // Remove HTML Entities.
5083 $text = preg_replace($settings['html_entity_regexp'], '', $text);
5084
5085 // Convert connectors to spaces to count attached text as words.
5086 $text = preg_replace($settings['connector_regexp'], ' ', $text);
5087
5088 // Remove unwanted characters.
5089 $text = preg_replace($settings['remove_regexp'], '', $text);
5090 } else {
5091 // Convert HTML Entities to "a".
5092 $text = preg_replace($settings['html_entity_regexp'], 'a', $text);
5093
5094 // Remove surrogate points.
5095 $text = preg_replace($settings['astral_regexp'], 'a', $text);
5096 }
5097
5098 // Match with the selected type regular expression to count the items.
5099 return (int) preg_match_all($settings[$type . '_regexp'], $text);
5100 }
5101
5102 /**
5103 * EVF word Count
5104 *
5105 * @param string $text Text.
5106 * @param string $type Type of text.
5107 * @param array $settings Settings.
5108 *
5109 * @since 2.0.2
5110 */
5111 function evf_word_count($text, $type = 'words', $settings = array())
5112 {
5113 if (function_exists(' wp_word_count ')) {
5114 return wp_word_count($text, $type = 'words', $settings = array());
5115 } else {
5116 return _evf_word_count($text, $type = 'words', $settings = array());
5117 }
5118 }
5119
5120 if (! function_exists('evf_maybe_get_local_font_url')) {
5121 /**
5122 * If load fonts locally option is checked in settings, we download the font
5123 * locally and return the url for download font file.
5124 *
5125 * @param [string] $font_url Remote font url.
5126 * @return string
5127 */
5128 function evf_maybe_get_local_font_url($font_url)
5129 {
5130 $load_locally = get_option('everest_forms_load_fonts_locally', 'no');
5131
5132 if ('yes' === $load_locally) {
5133 $font_url = wptt_get_webfont_url($font_url);
5134 }
5135
5136 return $font_url;
5137 }
5138 }
5139
5140 if (! function_exists('evf_is_akismet_configured')) {
5141
5142 /**
5143 * Has the Akismet plugin been configured wih a valid API key?
5144 *
5145 * @since 2.4.0
5146 *
5147 * @return bool
5148 */
5149 function evf_is_akismet_configured()
5150 {
5151
5152 if (! is_plugin_active('akismet/akismet.php')) {
5153 return false;
5154 }
5155
5156 require_once WP_PLUGIN_DIR . '/akismet/akismet.php';
5157
5158 $akismet_instance = new Akismet();
5159 // Akismet will only allow an API key to be saved if it is a valid key.
5160 // We can assume that if there is an API key saved, it is valid.
5161 $api_key = $akismet_instance->get_api_key();
5162
5163 if (! empty($api_key)) {
5164 return true;
5165 }
5166
5167 return false;
5168 }
5169 }
5170
5171 if (! function_exists('evf_current_url')) {
5172 /**
5173 * Get the current URL.
5174 *
5175 * @since 2.4.0
5176 *
5177 * @return string
5178 */
5179 function evf_current_url()
5180 {
5181
5182 $parsed_home_url = wp_parse_url(home_url());
5183
5184 $url = $parsed_home_url['scheme'] . '://' . $parsed_home_url['host'];
5185
5186 if (! empty($parsed_home_url['port'])) {
5187 $url .= ':' . $parsed_home_url['port'];
5188 }
5189
5190 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
5191 $url .= wp_unslash($_SERVER['REQUEST_URI']);
5192
5193 return esc_url_raw($url);
5194 }
5195 }
5196
5197 if (! function_exists('evf_get_utc_time_to')) {
5198 /**
5199 * Formats the end time in UTC format.
5200 *
5201 * @since 2.0.9
5202 *
5203 * @param string $evf_entries_report_summary_offset Time offest to be formatted in UTC time.
5204 * @param string $evf_format DateTime format for UTC time.
5205 * @param bool $evf_display Display the time.
5206 *
5207 * @return datetime end_time in UTC format.
5208 */
5209 function evf_get_utc_time_to($evf_entries_report_summary_offset, $evf_format = 'Y-m-d H:i:s', $evf_display = false)
5210 {
5211
5212 // Get local time 23:59:59 today.
5213 $evf_time_to_local = wp_date('Y-m-d 23:59:59');
5214 $evf_format = 'Y-m-d H:i:s';
5215
5216 // Get local time to.
5217 $evf_time_to_offset = strtotime($evf_entries_report_summary_offset, strtotime($evf_time_to_local));
5218
5219 if ($evf_display) {
5220
5221 return gmdate($evf_format, $evf_time_to_offset);
5222 } else {
5223
5224 return strtotime(get_gmt_from_date(gmdate($evf_format, $evf_time_to_offset)));
5225 }
5226 }
5227 }
5228
5229
5230 if (! function_exists('evf_get_utc_time_from')) {
5231 /**
5232 * Extarcts the start time in UTC format.
5233 *
5234 * @since 2.0.9
5235 *
5236 * @param string $evf_entries_report_summary_offset Start time to be formated in UTC format.
5237 * @param string $evf_format DateTime format for start time.
5238 * @param bool $evf_display To hide or display the time.
5239 *
5240 * @return datetime start_time in utc format.
5241 */
5242 function evf_get_utc_time_from($evf_entries_report_summary_offset, $evf_format = 'Y-m-d H:i:s', $evf_display = false)
5243 {
5244
5245 // Get local time midnight today.
5246 $evf_time_from_local = wp_date('Y-m-d 00:00:00');
5247 $evf_format = 'Y-m-d H:i:s';
5248
5249 // Get local time from.
5250 $evf_time_from_offset = strtotime($evf_entries_report_summary_offset, strtotime($evf_time_from_local));
5251
5252 if ($evf_display) {
5253
5254 return gmdate($evf_format, $evf_time_from_offset);
5255 } else {
5256
5257 return strtotime(get_gmt_from_date(gmdate($evf_format, $evf_time_from_offset)));
5258 }
5259 }
5260 }
5261
5262
5263 if (! function_exists('evf_summary_start_offset_time')) {
5264 /**
5265 * Extracts the start offset time according to the duration.
5266 *
5267 * @since 2.0.9
5268 * @return datetime $starttime.
5269 */
5270 function evf_summary_start_offset_time()
5271 {
5272 // Get options.
5273 $evf_report_frequency = get_option('everest_forms_entries_reporting_frequency', 'Weekly');
5274 $evf_report_offset_from = '';
5275 $evf_report_email_to = '';
5276 $evf_date_format = '';
5277 $evf_report_offset_to = '';
5278
5279 // Set everest forms reporting frequency specific variables.
5280 switch ($evf_report_frequency) {
5281
5282 case 'Daily':
5283 $evf_report_email_title = __('Everest Forms Daily Entries Statistics Report', 'everest-forms');
5284 $evf_report_offset_from = '-1 days';
5285 break;
5286
5287 case 'Weekly':
5288 $evf_report_email_title = __('Everest Forms Weekly Entries Statistics Report', 'everest-forms');
5289 $evf_report_offset_from = '-8 days';
5290 break;
5291
5292 case 'Monthly':
5293 $evf_report_email_title = __('Everest Forms Monthly Entries Statistics Report', 'everest-forms');
5294 $evf_report_offset_from = '-1 month -1 day';
5295 break;
5296 }
5297
5298 // Build date range.
5299 $date_format = get_option('date_format');
5300
5301 $start_time = evf_get_utc_time_from($evf_report_offset_from, $date_format, true);
5302 return $start_time;
5303 }
5304 }
5305
5306 if (! function_exists('evf_summary_end_offset_time')) {
5307 /**
5308 * Extracts the end offset time according to the duration.
5309 *
5310 * @since 2.0.9
5311 * @return datetime $end_time.
5312 */
5313 function evf_summary_end_offset_time()
5314 {
5315 // Get options.
5316 $evf_report_frequency = get_option('everest_forms_entries_reporting_frequency', 'Weekly');
5317 $evf_report_offset_from = '';
5318 $evf_report_email_to = '';
5319 $evf_date_format = '';
5320 $evf_report_offset_to = '';
5321
5322 // Set everest forms reporting frequency specific variables.
5323 switch ($evf_report_frequency) {
5324
5325 case 'Daily':
5326 $evf_report_email_title = __('Everest Forms Daily Entries Statistics Report', 'everest-forms');
5327 $evf_report_offset_to = '-1 day';
5328 break;
5329
5330 case 'Weekly':
5331 $evf_report_email_title = __('Everest Forms Weekly Entries Statistics Report', 'everest-forms');
5332 $evf_report_offset_to = '-1 day';
5333 break;
5334
5335 case 'Monthly':
5336 $evf_report_email_title = __('Everest Forms Monthly Entries Statistics Report', 'everest-forms');
5337 $evf_report_offset_to = '-1 day';
5338 break;
5339 }
5340
5341 // Build date range.
5342 $date_format = get_option('date_format');
5343
5344 $end_time = evf_get_utc_time_to($evf_report_offset_to, $date_format, true);
5345
5346 return $end_time;
5347 }
5348 }
5349
5350
5351 if (! function_exists('evf_process_all_fields_smart_tag')) {
5352 /**
5353 * Return email content wrapped in email template if {all_fields} is there in email content.
5354 *
5355 * @since 2.0.5
5356 * @param string $email_content Email Content.
5357 * @return string
5358 */
5359 function evf_process_all_fields_smart_tag($email_content)
5360 {
5361
5362 $email_content = '<div class="evf-all-fields-smart-tag-email-body" background-color: #ebebeb;">';
5363 $email_content .= '<table border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;border-collapse:collapse background:#cccccc" >';
5364 $email_content .= '<tbody>';
5365 $email_content .= '<tr>';
5366 $email_content .= '<td valign="top">';
5367 $email_content .= '<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;border-collapse:collapse" class="mcnTextContentContainer">';
5368 $email_content .= '<tbody>';
5369 $email_content .= '<tr>';
5370 $email_content .= '<td valign = "top" class = "mcnTextContent">';
5371 $email_content .= "<table align = 'left' border = '0' cellpadding = '0' cellspacing = '0' width = '100%' style = 'display:block;min-width:100%;border-collapse:collapse;width:100%'>";
5372 $email_content .= '<tbody>';
5373 $email_content .= '<tr>';
5374 $email_content .= "<td style = 'color:#333333;padding-top:20px;padding-bottom:3px'><strong>Name</strong></td>";
5375 $email_content .= '</tr>';
5376 $email_content .= '<tr>';
5377 $email_content .= "<td style = 'color:#555555;padding-top:3px;padding-bottom:20px'>Demo Name</td>";
5378 $email_content .= '</tr>';
5379 $email_content .= '</tbody>';
5380 $email_content .= '</table>';
5381 $email_content .= "<table align = 'left' border = '0' cellpadding = '0' cellspacing = '0' width = '100%' style = 'border-top:1px solid #dddddd;display:block;min-width:100%;border-collapse:collapse;width:100%'>";
5382 $email_content .= '<tbody>';
5383 $email_content .= '<tr>';
5384 $email_content .= "<td style = 'color:#333333;padding-top:20px;padding-bottom:3px'> <strong>Email</strong><tr / td >";
5385 $email_content .= '</tr>';
5386 $email_content .= '<tr>';
5387 $email_content .= "<td style = 'color:#555555;padding-top:3px;padding-bottom:20px' > <a href = '#' target = '_blank'>Demo Email</a></td>";
5388 $email_content .= '</tr>';
5389 $email_content .= '</tbody>';
5390 $email_content .= '</table>';
5391 $email_content .= "<table align = 'left' border = '0' cellpadding = '0' cellspacing = '0' width = '100%' style = 'border-top:1px solid #dddddd;display:block;min-width:100%;border-collapse:collapse;width:100%'>";
5392 $email_content .= '<tbody>';
5393 $email_content .= '<tr>';
5394 $email_content .= "<td style = 'color:#333333;padding-top:20px;padding-bottom:3px'><strong>Email Subject</strong></td>";
5395 $email_content .= '</tr>';
5396 $email_content .= '<tr>';
5397 $email_content .= "<td style = 'color:#555555;padding-top:3px;padding-bottom:20px'>Demo Email Subject</td>";
5398 $email_content .= '</tr>';
5399 $email_content .= '</tbody>';
5400 $email_content .= '</table>';
5401 $email_content .= "<table align = 'left' border = '0' cellpadding = '0' cellspacing = '0' width = '100%' style = 'border-top:1px solid #dddddd;display:block;min-width:100%;border-collapse:collapse;width:100%'>";
5402 $email_content .= '<tbody>';
5403 $email_content .= '<tr>';
5404 $email_content .= "<td style = 'color:#333333;padding-top:20px;padding-bottom:3px'><strong>Email Message</strong></td>";
5405 $email_content .= '</tr>';
5406 $email_content .= '<tr>';
5407 $email_content .= "<td style = 'color:#555555;padding-top:3px;padding-bottom:20px'>Demo Email Message</td>";
5408 $email_content .= '</tr>';
5409 $email_content .= '</tbody>';
5410 $email_content .= '</table>';
5411 $email_content .= '</td>';
5412 $email_content .= '</tr>';
5413 $email_content .= '</tbody>';
5414 $email_content .= '</table>';
5415 $email_content .= '</td>';
5416 $email_content .= '</tr>';
5417 $email_content .= '</tbody>';
5418 $email_content .= '</table>';
5419 $email_content .= '</div>';
5420
5421 return $email_content;
5422 }
5423 }
5424
5425
5426
5427 /**
5428 * Get one time draggable fields fields.
5429 *
5430 * @return array
5431 */
5432 function evf_get_one_time_draggable_fields()
5433 {
5434 return apply_filters(
5435 'everest_forms_one_time_draggable_form_fields',
5436 array(
5437 'file-upload',
5438 )
5439 );
5440 }
5441
5442 /**
5443 * Retrieve the next key in an array from given key.
5444 *
5445 * @param array $arr List of items in a form of array.
5446 * @param integer $key Key to search and find within the array.
5447 * @return mixed
5448 */
5449 function evf_get_next_key_array($arr, $key)
5450 {
5451 $keys = array_keys($arr);
5452 $position = array_search($key, $keys, true);
5453
5454 if (isset($keys[$position + 1])) {
5455 $next_key = $keys[$position + 1];
5456 }
5457
5458 return isset($next_key) ? $next_key : '';
5459 }
5460 /**
5461 * Function to generate the api key base on the string.
5462 *
5463 * @since 3.0.5
5464 * @param $string The string value.
5465 */
5466 function generate_api_key($string = 'evf_restapi', $length = 32)
5467 {
5468 $key = bin2hex(random_bytes($length));
5469
5470 return $key;
5471 }
5472
5473 if (! function_exists('evf_hex_to_rgb')) {
5474 /**
5475 * Converts a hex color code to an RGB array.
5476 *
5477 * @since 3.0.5
5478 * @param string $hexcolor Hex color code, with or without '#'.
5479 * @return array RGB values as [red, green, blue].
5480 */
5481 function evf_hex_to_rgb($hexcolor)
5482 {
5483 $hexcolor = ltrim($hexcolor, '#');
5484
5485 if (strlen($hexcolor) == 6) {
5486 $r = hexdec(substr($hexcolor, 0, 2));
5487 $g = hexdec(substr($hexcolor, 2, 2));
5488 $b = hexdec(substr($hexcolor, 4, 2));
5489 } elseif (strlen($hexcolor) == 3) {
5490 $r = hexdec(str_repeat(substr($hexcolor, 0, 1), 2));
5491 $g = hexdec(str_repeat(substr($hexcolor, 1, 1), 2));
5492 $b = hexdec(str_repeat(substr($hexcolor, 2, 1), 2));
5493 } else {
5494 return array(0, 0, 0);
5495 }
5496
5497 return array($r, $g, $b);
5498 }
5499 }
5500
5501 add_action('wp_mail_failed', 'evf_email_send_failed_handler', 1);
5502
5503 if (! function_exists('evf_email_send_failed_handler')) {
5504
5505 /**
5506 * Handle errors fetch mechanism when mail send failed.
5507 *
5508 * @param object $error_instance WP_Error message instance.
5509 */
5510 function evf_email_send_failed_handler($error_instance)
5511 {
5512 $error_message = '';
5513 $decoded_message = json_decode($error_instance->get_error_message());
5514
5515 if (json_last_error() === JSON_ERROR_NONE && ! empty($decoded_message)) {
5516 /* translators: %s: Status Log URL */
5517 $error_message = wp_kses_post(sprintf(__('Please check the `evf_mail_errors` log under <a target="_blank" href="%s"> Logs </a> section.', 'everest-forms'), admin_url('admin.php?page=evf-tools&tab=logs')));
5518 } else {
5519 $error_message = $error_instance->get_error_message();
5520 }
5521
5522 evf_get_logger()->info(
5523 $error_message,
5524 array('source' => 'evf_mail_errors')
5525 );
5526
5527 if (! empty($error_message)) {
5528 add_filter(
5529 'everest_forms_email_send_failed_message',
5530 function ($msg) use ($error_message) {
5531 return $error_message;
5532 }
5533 );
5534 }
5535 }
5536 }
5537
5538 /**
5539 * Get form data by field key.
5540 *
5541 * @param array $form_data Form Data.
5542 * @param string $key Field Key.
5543 *
5544 * @return array
5545 */
5546 function evf_get_form_data_by_key($form_data, $key = null)
5547 {
5548
5549 $form_data_array = array();
5550
5551 foreach ($form_data['form_fields'] as $field_data) {
5552
5553 $field_key = isset($field_data['type']) && null !== $field_data['type'] ? $field_data['type'] : '';
5554
5555 if (! empty($field_key)) {
5556 if ($field_key === $key) {
5557 $form_data_array[] = $field_data;
5558 }
5559 }
5560 }
5561
5562 return $form_data_array;
5563 }
5564
5565 add_action(
5566 'admin_head',
5567 function () {
5568 $js = <<<JS
5569 const isSidebarEnabled = localStorage.getItem( 'isPremiumSidebarEnabled' );
5570 const interval = setInterval( () => {
5571 if ( document.body ) {
5572 clearInterval(interval);
5573 if ('true' === isSidebarEnabled) {
5574 document.body.classList.add( 'evf-premium-sidebar-show' );
5575 } else {
5576 document.body.classList.add( 'evf-premium-sidebar-hidden' );
5577 }
5578 }
5579 }, 1 );
5580 JS;
5581 if (function_exists('wp_print_inline_script_tag')) {
5582 wp_print_inline_script_tag($js);
5583 }
5584 }
5585 );
5586
5587 /**
5588 * Get the list of addons or module that are depended on another plugins.
5589 *
5590 * @since 3.2.2
5591 */
5592 function evf_get_addons_list_depend_on_another_plugins()
5593 {
5594 $required_plugins = apply_filters(
5595 'everest_forms_required_plugins_lists',
5596 array(
5597 'everest-forms-woocommerce' => array(
5598 'file' => 'woocommerce/woocommerce.php',
5599 'name' => 'WooCommerce',
5600 ),
5601 'everest-forms-mailpoet' => array(
5602 'file' => 'mailpoet/mailpoet.php',
5603 'name' => 'MailPoet',
5604 ),
5605 'everest-forms-oxygen-builder' => array(
5606 'file' => 'oxygen/functions.php',
5607 'name' => 'Oxygen Builder',
5608 ),
5609 'everest-forms-beaver-builder' => array(
5610 'file' => array(
5611 'beaver-builder-lite-version/fl-builder.php',
5612 'bb-plugin/fl-builder.php',
5613 ),
5614 'name' => 'Beaver Builder',
5615 ),
5616 'everest-forms-wpbakery-builder' => array(
5617 'file' => 'js_composer/js_composer.php',
5618 'name' => 'WPBakery Builder',
5619 ),
5620 'everest-forms-divi-builder' => array(
5621 'is_theme' => true,
5622 'name' => 'Divi Builder',
5623 'id' => 'Divi',
5624 ),
5625 'everest-forms-bricks-builder' => array(
5626 'is_theme' => true,
5627 'name' => 'Bricks Builder',
5628 'id' => 'bricks',
5629 ),
5630 )
5631 );
5632
5633 return $required_plugins;
5634 }
5635
5636
5637 if (! function_exists('evf_maybe_unserialize')) {
5638 /**
5639 * EVF Unserialize data.
5640 *
5641 * @param string $data Data that might be unserialized.
5642 * @param array $options Options.
5643 *
5644 * @return mixed Unserialized data can be any type.
5645 *
5646 * @since 3.1.2
5647 */
5648 function evf_maybe_unserialize($data, $options = array())
5649 {
5650
5651 if (is_serialized($data)) {
5652 if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
5653 $options = wp_parse_args($options, array('allowed_classes' => false));
5654 return @unserialize(trim($data), $options); //phpcs:ignore.
5655 }
5656 //Blocked unserialize() attempt on PHP < 7.1
5657 return null;
5658 }
5659
5660 return $data;
5661 }
5662 }
5663
5664 /**
5665 * Confimation backward compatiblity.
5666 *
5667 * @since 3.4.0
5668 * @param [type] $form_data The old form data.
5669 */
5670 function evf_form_confirmation_backward_compatibility($form_data)
5671 {
5672 if (empty($form_data)) {
5673 return $form_data;
5674 }
5675 //If the form is updated then return original form data.
5676 if (get_post_meta($form_data['id'], 'updated_form_confirmation', true)) {
5677 return $form_data;
5678 }
5679
5680 $settings = $form_data['settings'];
5681 $submission_redirection = isset($settings['submission_redirection']) ? $settings['submission_redirection'] : array();
5682 if (empty($submission_redirection)) {
5683 return $form_data;
5684 }
5685
5686 $updated_conditionals = array();
5687 if (isset($submission_redirection['connection_1']['conditionals'])) {
5688 $conditionals = isset($submission_redirection['connection_1']['conditionals']) ? $submission_redirection['connection_1']['conditionals'] : array();
5689 $rules = isset($submission_redirection['connection_1']['rules']) ? $submission_redirection['connection_1']['rules'] : array();
5690
5691 if (empty($rules) || empty($conditionals)) {
5692 return $form_data;
5693 }
5694
5695 foreach ($conditionals['rules'] as $key => $conditional) {
5696 $updated_conditionals['rules'][$key] = $conditional;
5697
5698 $settings = array(
5699 'title' => 'Conditional Confirmations',
5700 'redirect_to' => isset($rules[$key]['conditional_option']) ? ('same_page' === $rules[$key]['conditional_option'] ? 'same' : $rules[$key]['conditional_option']) : 'same',
5701 'custom_page' => isset($rules[$key]['conditional_option_redirection_custom_page']) ? $rules[$key]['conditional_option_redirection_custom_page'] : 0,
5702 'external_url' => isset($rules[$key]['conditional_option_redirection_external_url']) ? $rules[$key]['conditional_option_redirection_custom_page'] : 0,
5703 'enable_redirect_in_new_tab' => 0,
5704 'enable_redirect_query_string' => 0,
5705 'query_string' => isset($settings['query_string']) ? $settings['query_string'] : '',
5706 'successful_form_submission_message' => isset(
5707 $settings[' [successful_form_submission_message] => Thanks for contacting us! We will be in touch with you shortly
5708 ']
5709 ) ? $settings[' [successful_form_submission_message] => Thanks for contacting us! We will be in touch with you shortly
5710 '] : 'Thanks for contacting us! We will be in touch with you shortly',
5711 'submission_message_scroll' => isset($settings['submission_message_scroll']) ? $settings['submission_message_scroll'] : 0,
5712 'form_state_type' => 'hide',
5713 'preview_confirmation' => isset($settings['preview_confirmation']) ? $settings['preview_confirmation'] : 0,
5714 'preview_confirmation_select' => isset($settings['preview_confirmation_select']) ? $settings['preview_confirmation_select'] : 'basic',
5715 'message_display_location_of_hide' => 'hide',
5716 'message_display_location_of_reset' => 'top',
5717 'active' => 1,
5718 );
5719
5720 $updated_conditionals['rules'][$key]['settings'] = $settings;
5721 }
5722 }
5723
5724 if (! empty($updated_conditionals)) {
5725 $form_data['settings']['submission_redirection']['connection_1']['conditionals'] = $updated_conditionals;
5726 }
5727
5728 return $form_data;
5729 }
5730