PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.17.0
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.17.0
4.17.2 4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / third-party / vendor / nesbot / carbon / src / Carbon / Language.php
wp-user-avatar / third-party / vendor / nesbot / carbon / src / Carbon Last commit date
Cli 2 months ago Exceptions 2 months ago Lang 2 months ago Laravel 2 months ago List 2 months ago MessageFormatter 2 months ago PHPStan 2 months ago Traits 2 months ago AbstractTranslator.php 2 months ago Carbon.php 2 months ago CarbonConverterInterface.php 2 months ago CarbonImmutable.php 2 months ago CarbonInterface.php 2 months ago CarbonInterval.php 2 months ago CarbonPeriod.php 2 months ago CarbonPeriodImmutable.php 2 months ago CarbonTimeZone.php 2 months ago Factory.php 2 months ago FactoryImmutable.php 2 months ago Language.php 2 months ago Translator.php 2 months ago TranslatorImmutable.php 2 months ago TranslatorStrongTypeInterface.php 2 months ago
Language.php
292 lines
1 <?php
2
3 /**
4 * This file is part of the Carbon package.
5 *
6 * (c) Brian Nesbitt <brian@nesbot.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace ProfilePressVendor\Carbon;
12
13 use JsonSerializable;
14 use ReturnTypeWillChange;
15 class Language implements JsonSerializable
16 {
17 /**
18 * @var array
19 */
20 protected static $languagesNames;
21 /**
22 * @var array
23 */
24 protected static $regionsNames;
25 /**
26 * @var string
27 */
28 protected $id;
29 /**
30 * @var string
31 */
32 protected $code;
33 /**
34 * @var string|null
35 */
36 protected $variant;
37 /**
38 * @var string|null
39 */
40 protected $region;
41 /**
42 * @var array
43 */
44 protected $names;
45 /**
46 * @var string
47 */
48 protected $isoName;
49 /**
50 * @var string
51 */
52 protected $nativeName;
53 public function __construct(string $id)
54 {
55 $this->id = str_replace('-', '_', $id);
56 $parts = explode('_', $this->id);
57 $this->code = $parts[0];
58 if (isset($parts[1])) {
59 if (!preg_match('/^[A-Z]+$/', $parts[1])) {
60 $this->variant = $parts[1];
61 $parts[1] = $parts[2] ?? null;
62 }
63 if ($parts[1]) {
64 $this->region = $parts[1];
65 }
66 }
67 }
68 /**
69 * Get the list of the known languages.
70 *
71 * @return array
72 */
73 public static function all()
74 {
75 if (!static::$languagesNames) {
76 static::$languagesNames = require __DIR__ . '/List/languages.php';
77 }
78 return static::$languagesNames;
79 }
80 /**
81 * Get the list of the known regions.
82 *
83 * @return array
84 */
85 public static function regions()
86 {
87 if (!static::$regionsNames) {
88 static::$regionsNames = require __DIR__ . '/List/regions.php';
89 }
90 return static::$regionsNames;
91 }
92 /**
93 * Get both isoName and nativeName as an array.
94 *
95 * @return array
96 */
97 public function getNames(): array
98 {
99 if (!$this->names) {
100 $this->names = static::all()[$this->code] ?? ['isoName' => $this->code, 'nativeName' => $this->code];
101 }
102 return $this->names;
103 }
104 /**
105 * Returns the original locale ID.
106 *
107 * @return string
108 */
109 public function getId(): string
110 {
111 return $this->id;
112 }
113 /**
114 * Returns the code of the locale "en"/"fr".
115 *
116 * @return string
117 */
118 public function getCode(): string
119 {
120 return $this->code;
121 }
122 /**
123 * Returns the variant code such as cyrl/latn.
124 *
125 * @return string|null
126 */
127 public function getVariant(): ?string
128 {
129 return $this->variant;
130 }
131 /**
132 * Returns the variant such as Cyrillic/Latin.
133 *
134 * @return string|null
135 */
136 public function getVariantName(): ?string
137 {
138 if ($this->variant === 'Latn') {
139 return 'Latin';
140 }
141 if ($this->variant === 'Cyrl') {
142 return 'Cyrillic';
143 }
144 return $this->variant;
145 }
146 /**
147 * Returns the region part of the locale.
148 *
149 * @return string|null
150 */
151 public function getRegion(): ?string
152 {
153 return $this->region;
154 }
155 /**
156 * Returns the region name for the current language.
157 *
158 * @return string|null
159 */
160 public function getRegionName(): ?string
161 {
162 return $this->region ? static::regions()[$this->region] ?? $this->region : null;
163 }
164 /**
165 * Returns the long ISO language name.
166 *
167 * @return string
168 */
169 public function getFullIsoName(): string
170 {
171 if (!$this->isoName) {
172 $this->isoName = $this->getNames()['isoName'];
173 }
174 return $this->isoName;
175 }
176 /**
177 * Set the ISO language name.
178 *
179 * @param string $isoName
180 */
181 public function setIsoName(string $isoName): self
182 {
183 $this->isoName = $isoName;
184 return $this;
185 }
186 /**
187 * Return the full name of the language in this language.
188 *
189 * @return string
190 */
191 public function getFullNativeName(): string
192 {
193 if (!$this->nativeName) {
194 $this->nativeName = $this->getNames()['nativeName'];
195 }
196 return $this->nativeName;
197 }
198 /**
199 * Set the name of the language in this language.
200 *
201 * @param string $nativeName
202 */
203 public function setNativeName(string $nativeName): self
204 {
205 $this->nativeName = $nativeName;
206 return $this;
207 }
208 /**
209 * Returns the short ISO language name.
210 *
211 * @return string
212 */
213 public function getIsoName(): string
214 {
215 $name = $this->getFullIsoName();
216 return trim(strstr($name, ',', \true) ?: $name);
217 }
218 /**
219 * Get the short name of the language in this language.
220 *
221 * @return string
222 */
223 public function getNativeName(): string
224 {
225 $name = $this->getFullNativeName();
226 return trim(strstr($name, ',', \true) ?: $name);
227 }
228 /**
229 * Get a string with short ISO name, region in parentheses if applicable, variant in parentheses if applicable.
230 *
231 * @return string
232 */
233 public function getIsoDescription()
234 {
235 $region = $this->getRegionName();
236 $variant = $this->getVariantName();
237 return $this->getIsoName() . ($region ? ' (' . $region . ')' : '') . ($variant ? ' (' . $variant . ')' : '');
238 }
239 /**
240 * Get a string with short native name, region in parentheses if applicable, variant in parentheses if applicable.
241 *
242 * @return string
243 */
244 public function getNativeDescription()
245 {
246 $region = $this->getRegionName();
247 $variant = $this->getVariantName();
248 return $this->getNativeName() . ($region ? ' (' . $region . ')' : '') . ($variant ? ' (' . $variant . ')' : '');
249 }
250 /**
251 * Get a string with long ISO name, region in parentheses if applicable, variant in parentheses if applicable.
252 *
253 * @return string
254 */
255 public function getFullIsoDescription()
256 {
257 $region = $this->getRegionName();
258 $variant = $this->getVariantName();
259 return $this->getFullIsoName() . ($region ? ' (' . $region . ')' : '') . ($variant ? ' (' . $variant . ')' : '');
260 }
261 /**
262 * Get a string with long native name, region in parentheses if applicable, variant in parentheses if applicable.
263 *
264 * @return string
265 */
266 public function getFullNativeDescription()
267 {
268 $region = $this->getRegionName();
269 $variant = $this->getVariantName();
270 return $this->getFullNativeName() . ($region ? ' (' . $region . ')' : '') . ($variant ? ' (' . $variant . ')' : '');
271 }
272 /**
273 * Returns the original locale ID.
274 *
275 * @return string
276 */
277 public function __toString()
278 {
279 return $this->getId();
280 }
281 /**
282 * Get a string with short ISO name, region in parentheses if applicable, variant in parentheses if applicable.
283 *
284 * @return string
285 */
286 #[ReturnTypeWillChange]
287 public function jsonSerialize()
288 {
289 return $this->getIsoDescription();
290 }
291 }
292