PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 All 123 releases
firebox / Inc / Framework / Inc / Base / Factory / Language.php

Language.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 3.1.14, at Inc/Framework/Inc/Base/Factory/Language.php

99 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package FirePlugins Framework
4 * @version 1.2.6
5 *
6 * @author FirePlugins <[email protected]>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2026 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FPFramework\Base\Factory;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 use \FPFramework\Libs\Registry;
20
21 class Language
22 {
23 private $data = [];
24
25 public function __construct()
26 {
27 $this->setData();
28 }
29
30 private function setData()
31 {
32 $this->data = $this->getData();
33 }
34
35 private function getData()
36 {
37 $data = [
38 'url' => $this->getLanguageURL(),
39 'locale' => $this->getLocale(),
40 'user_locale' => $this->getUserLocale()
41 ];
42
43 $data = new Registry($data);
44 return $data;
45 }
46
47 /**
48 * Retrieves the language URL
49 * Example: en_US => en
50 *
51 * @return string
52 */
53 private function getLanguageURL()
54 {
55 $default_lang = 'en';
56 $locale = $this->getUserLocale();
57
58 if (!empty($locale))
59 {
60 $lang = explode( '_', $locale );
61 if (!empty($lang) && is_array($lang))
62 {
63 $default_lang = strtolower($lang[0]);
64 }
65 }
66
67 return $default_lang;
68 }
69
70 /**
71 * Returns the current locale
72 *
73 * @return string
74 */
75 protected function getLocale()
76 {
77 return get_locale();
78 }
79
80 /**
81 * Returns the user locale
82 *
83 * @return string
84 */
85 protected function getUserLocale()
86 {
87 return get_user_locale();
88 }
89
90 public function get($key)
91 {
92 if (!$this->data->get($key))
93 {
94 return '';
95 }
96
97 return $this->data->get($key);
98 }
99 }