PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 3.6.1
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v3.6.1
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / WordPress / LocalizationStateService.php
LocalizationStateService.php
856 lines 16.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\WordPress;
4
5 /**
6 * LocalizationStateService class.
7 */
8 class LocalizationStateService {
9 /**
10 * Get the localization state.
11 */
12 public function get() {
13 return [
14 'defaultCountryFields' => $this->getDefaultCountryFields(),
15 'countryFields' => $this->getCountryFields(),
16 ];
17 }
18
19 /**
20 * Get default country fields.
21 *
22 * @return array
23 */
24 public function getDefaultCountryFields(): array {
25 return apply_filters(
26 'surecart_default_country_fields',
27 array(
28 array(
29 'name' => 'country',
30 'priority' => 30,
31 'label' => __( 'Country', 'surecart' ),
32 ),
33 array(
34 'name' => 'name',
35 'priority' => 40,
36 'label' => __( 'Name or Company Name', 'surecart' ),
37 ),
38 array(
39 'name' => 'address_1',
40 'priority' => 50,
41 'label' => __( 'Address', 'surecart' ),
42 ),
43 array(
44 'name' => 'address_2',
45 'priority' => 60,
46 'label' => __( 'Line 2', 'surecart' ),
47 ),
48 array(
49 'name' => 'city',
50 'priority' => 70,
51 'label' => __( 'City', 'surecart' ),
52 ),
53 array(
54 'name' => 'state',
55 'priority' => 80,
56 'label' => __( 'State / County', 'surecart' ),
57 ),
58 array(
59 'name' => 'postcode',
60 'priority' => 90,
61 'label' => __( 'Postal Code', 'surecart' ),
62 ),
63 ),
64 );
65 }
66
67 /**
68 * Get country fields.
69 *
70 * @return array
71 */
72 public function getCountryFields(): array {
73 return apply_filters(
74 'surecart_country_fields',
75 array(
76 'AL' => array(
77 'state' => array(
78 'label' => __( 'County', 'surecart' ),
79 ),
80 ),
81 'AO' => array(
82 'state' => array(
83 'label' => __( 'Province', 'surecart' ),
84 ),
85 ),
86 'DZ' => array(
87 'postcode' => array(
88 'priority' => 65,
89 ),
90 ),
91 'AT' => array(
92 'postcode' => array(
93 'priority' => 65,
94 ),
95 ),
96 'AU' => array(
97 'city' => array(
98 'label' => __( 'Suburb', 'surecart' ),
99 ),
100 'postcode' => array(
101 'label' => __( 'Postcode', 'surecart' ),
102 ),
103 'state' => array(
104 'label' => __( 'State / Territory', 'surecart' ),
105 ),
106 ),
107 'AR' => array(
108 'postcode' => array(
109 'priority' => 65,
110 ),
111 'state' => array(
112 'priority' => 90,
113 'label' => __( 'Province', 'surecart' ),
114 ),
115 ),
116 'AM' => array(
117 'postcode' => array(
118 'priority' => 65,
119 ),
120 ),
121 'AX' => array(
122 'postcode' => array(
123 'priority' => 65,
124 ),
125 ),
126 'AZ' => array(
127 'postcode' => array(
128 'priority' => 65,
129 ),
130 ),
131 'BA' => array(
132 'postcode' => array(
133 'priority' => 65,
134 ),
135 'state' => array(
136 'label' => __( 'Canton', 'surecart' ),
137 ),
138 ),
139 'BD' => array(
140 'state' => array(
141 'label' => __( 'District', 'surecart' ),
142 ),
143 ),
144 'BE' => array(
145 'postcode' => array(
146 'priority' => 65,
147 ),
148 ),
149 'BF' => array(
150 'postcode' => array(
151 'priority' => 65,
152 ),
153 ),
154 'BH' => array(
155 'postcode' => array(
156 'priority' => 75,
157 ),
158 ),
159 'BO' => array(
160 'state' => array(
161 'label' => __( 'Department', 'surecart' ),
162 ),
163 ),
164 'BB' => array(
165 'postcode' => array(
166 'priority' => 75,
167 ),
168 ),
169 'BR' => array(
170 'postcode' => array(
171 'priority' => 45,
172 ),
173 'state' => array(
174 'label' => __( 'State', 'surecart' ),
175 ),
176 ),
177 'BY' => array(
178 'postcode' => array(
179 'priority' => 65,
180 ),
181 ),
182 'BG' => array(
183 'postcode' => array(
184 'priority' => 65,
185 ),
186 ),
187 'CA' => array(
188 'postcode' => array(
189 'label' => __( 'Postal Code', 'surecart' ),
190 ),
191 'state' => array(
192 'label' => __( 'Province', 'surecart' ),
193 ),
194 ),
195 'CH' => array(
196 'postcode' => array(
197 'priority' => 65,
198 ),
199 'state' => array(
200 'label' => __( 'Canton', 'surecart' ),
201 ),
202 ),
203 'CL' => array(
204 'postcode' => array(
205 'priority' => 65,
206 ),
207 'state' => array(
208 'label' => __( 'Region', 'surecart' ),
209 ),
210 ),
211 'CN' => array(
212 'state' => array(
213 'label' => __( 'Province', 'surecart' ),
214 ),
215 ),
216 'CO' => array(
217 'state' => array(
218 'label' => __( 'Province', 'surecart' ),
219 ),
220 ),
221 'CR' => array(
222 'state' => array(
223 'priority' => 70,
224 'label' => __( 'Province', 'surecart' ),
225 ),
226 'city' => array(
227 'priority' => 80,
228 ),
229 ),
230 'CV' => array(
231 'postcode' => array(
232 'priority' => 65,
233 ),
234 ),
235 'CY' => array(
236 'postcode' => array(
237 'priority' => 65,
238 ),
239 ),
240 'CZ' => array(
241 'postcode' => array(
242 'priority' => 65,
243 ),
244 ),
245 'HR' => array(
246 'postcode' => array(
247 'priority' => 65,
248 ),
249 ),
250 'DE' => array(
251 'postcode' => array(
252 'priority' => 65,
253 ),
254 ),
255 'DK' => array(
256 'postcode' => array(
257 'priority' => 65,
258 ),
259 ),
260 'DO' => array(
261 'postcode' => array(
262 'priority' => 65,
263 ),
264 'state' => array(
265 'label' => __( 'Province', 'surecart' ),
266 ),
267 ),
268 'EC' => array(
269 'postcode' => array(
270 'priority' => 65,
271 ),
272 'state' => array(
273 'label' => __( 'Province', 'surecart' ),
274 ),
275 ),
276 'EE' => array(
277 'postcode' => array(
278 'priority' => 65,
279 ),
280 ),
281 'EG' => array(
282 'state' => array(
283 'label' => __( 'Governorate', 'surecart' ),
284 ),
285 ),
286 'FI' => array(
287 'postcode' => array(
288 'priority' => 65,
289 ),
290 ),
291 'FR' => array(
292 'postcode' => array(
293 'priority' => 65,
294 ),
295 ),
296
297 'GF' => array(
298 'postcode' => array(
299 'priority' => 65,
300 ),
301 ),
302 'PF' => array(
303 'postcode' => array(
304 'priority' => 65,
305 ),
306 ),
307 'GE' => array(
308 'postcode' => array(
309 'priority' => 65,
310 ),
311 ),
312 'GR' => array(
313 'postcode' => array(
314 'priority' => 65,
315 ),
316 ),
317 'GL' => array(
318 'postcode' => array(
319 'priority' => 65,
320 ),
321 ),
322 'GP' => array(
323 'postcode' => array(
324 'priority' => 65,
325 ),
326 ),
327 'GG' => array(
328 'state' => array(
329 'label' => __( 'Parish', 'surecart' ),
330 ),
331 ),
332 'GH' => array(
333 'state' => array(
334 'label' => __( 'Region', 'surecart' ),
335 ),
336 ),
337 'GT' => array(
338 'state' => array(
339 'label' => __( 'Region', 'surecart' ),
340 ),
341 ),
342 'HT' => array(
343 'postcode' => array(
344 'priority' => 65,
345 ),
346 ),
347 'HK' => array(
348 'city' => array(
349 'label' => __( 'Town / District', 'surecart' ),
350 ),
351 'state' => array(
352 'label' => __( 'Region', 'surecart' ),
353 ),
354 ),
355 'HN' => array(
356 'postcode' => array(
357 'priority' => 65,
358 ),
359 'state' => array(
360 'label' => __( 'Department', 'surecart' ),
361 ),
362 ),
363 'HU' => array(
364 'postcode' => array(
365 'priority' => 65,
366 ),
367 'address_1' => array(
368 'priority' => 71,
369 ),
370 'address_2' => array(
371 'priority' => 72,
372 ),
373 'state' => array(
374 'label' => __( 'County', 'surecart' ),
375 ),
376 ),
377 'ID' => array(
378 'state' => array(
379 'label' => __( 'Province', 'surecart' ),
380 ),
381 ),
382 'IE' => array(
383 'postcode' => array(
384 'label' => __( 'Eircode', 'surecart' ),
385 ),
386 'state' => array(
387 'label' => __( 'County', 'surecart' ),
388 ),
389 ),
390 'IS' => array(
391 'postcode' => array(
392 'priority' => 65,
393 ),
394 ),
395 'IL' => array(
396 'postcode' => array(
397 'priority' => 65,
398 ),
399 ),
400 'IN' => array(
401 'postcode' => array(
402 'label' => __( 'PIN Code', 'surecart' ),
403 ),
404 'state' => array(
405 'label' => __( 'State', 'surecart' ),
406 ),
407 ),
408 'IR' => array(
409 'state' => array(
410 'priority' => 50,
411 ),
412 'city' => array(
413 'priority' => 60,
414 ),
415 'address_1' => array(
416 'priority' => 70,
417 ),
418 'address_2' => array(
419 'priority' => 80,
420 ),
421 ),
422 'IT' => array(
423 'postcode' => array(
424 'priority' => 65,
425 ),
426 'state' => array(
427 'label' => __( 'Province', 'surecart' ),
428 ),
429 ),
430 'JM' => array(
431 'city' => array(
432 'label' => __( 'Town / City / Post Office', 'surecart' ),
433 ),
434 'postcode' => array(
435 'label' => __( 'Postal Code', 'surecart' ),
436 ),
437 'state' => array(
438 'label' => __( 'Parish', 'surecart' ),
439 ),
440 ),
441 'JP' => array(
442 'postcode' => array(
443 'priority' => 65,
444 ),
445 'state' => array(
446 'label' => __( 'Prefecture', 'surecart' ),
447 'priority' => 66,
448 ),
449 'city' => array(
450 'priority' => 67,
451 ),
452 'address_1' => array(
453 'priority' => 68,
454 ),
455 'address_2' => array(
456 'priority' => 69,
457 ),
458 ),
459 'KN' => array(
460 'postcode' => array(
461 'label' => __( 'Postal Code', 'surecart' ),
462 ),
463 'state' => array(
464 'label' => __( 'Parish', 'surecart' ),
465 ),
466 ),
467 'KW' => array(
468 'postcode' => array(
469 'priority' => 65,
470 ),
471 'state' => array(
472 'label' => __( 'Governorate', 'surecart' ),
473 ),
474 ),
475 'KG' => array(
476 'postcode' => array(
477 'priority' => 65,
478 ),
479 'city' => array(
480 'priority' => 70,
481 ),
482 'state' => array(
483 'priority' => 80,
484 ),
485 'address_1' => array(
486 'priority' => 85,
487 ),
488 'name' => array(
489 'priority' => 90,
490 ),
491 ),
492 'LV' => array(
493 'state' => array(
494 'label' => __( 'Municipality', 'surecart' ),
495 ),
496 ),
497 'LU' => array(
498 'postcode' => array(
499 'priority' => 65,
500 ),
501 ),
502 'MZ' => array(
503 'state' => array(
504 'label' => __( 'Province', 'surecart' ),
505 ),
506 ),
507 'MX' => array(
508 'postcode' => array(
509 'priority' => 65,
510 ),
511 'state' => array(
512 'label' => __( 'State', 'surecart' ),
513 ),
514 ),
515 'MY' => array(
516 'postcode' => array(
517 'priority' => 65,
518 'label' => __( 'Postcode', 'surecart' ),
519 ),
520 'state' => array(
521 'label' => __( 'State / Territory', 'surecart' ),
522 ),
523 ),
524 'NI' => array(
525 'postcode' => array(
526 'priority' => 65,
527 ),
528 'state' => array(
529 'label' => __( 'Department', 'surecart' ),
530 ),
531 ),
532 'NL' => array(
533 'postcode' => array(
534 'priority' => 65,
535 ),
536 ),
537 'MK' => array(
538 'postcode' => array(
539 'priority' => 65,
540 ),
541 ),
542 'NG' => array(
543 'postcode' => array(
544 'label' => __( 'Postcode', 'surecart' ),
545 ),
546 'state' => array(
547 'label' => __( 'State', 'surecart' ),
548 ),
549 ),
550 'NZ' => array(
551 'postcode' => array(
552 'label' => __( 'Postcode', 'surecart' ),
553 ),
554 'state' => array(
555 'label' => __( 'Region', 'surecart' ),
556 ),
557 ),
558 'NO' => array(
559 'postcode' => array(
560 'priority' => 65,
561 ),
562 ),
563 'NP' => array(
564 'state' => array(
565 'label' => __( 'State / Zone', 'surecart' ),
566 ),
567 ),
568 'NC' => array(
569 'postcode' => array(
570 'priority' => 65,
571 ),
572 ),
573 'OM' => array(
574 'postcode' => array(
575 'priority' => 65,
576 ),
577 ),
578 'PA' => array(
579 'postcode' => array(
580 'priority' => 65,
581 ),
582 'state' => array(
583 'label' => __( 'Region', 'surecart' ),
584 ),
585 ),
586 'PL' => array(
587 'postcode' => array(
588 'priority' => 65,
589 ),
590 ),
591 'PR' => array(
592 'city' => array(
593 'label' => __( 'Municipality', 'surecart' ),
594 ),
595 ),
596 'PY' => array(
597 'postcode' => array(
598 'priority' => 65,
599 ),
600 'state' => array(
601 'label' => __( 'Department', 'surecart' ),
602 ),
603 ),
604 'PH' => array(
605 'postcode' => array(
606 'priority' => 65,
607 ),
608 'state' => array(
609 'priority' => 90,
610 'label' => __( 'Region', 'surecart' ),
611 ),
612 ),
613 'PE' => array(
614 'state' => array(
615 'label' => __( 'Region', 'surecart' ),
616 ),
617 ),
618 'PT' => array(
619 'postcode' => array(
620 'priority' => 65,
621 ),
622 'state' => array(
623 'label' => __( 'Region', 'surecart' ),
624 ),
625 ),
626 'RO' => array(
627 'postcode' => array(
628 'priority' => 65,
629 ),
630 'state' => array(
631 'label' => __( 'County', 'surecart' ),
632 ),
633 ),
634 'RS' => array(
635 'postcode' => array(
636 'priority' => 65,
637 ),
638 'state' => array(
639 'label' => __( 'District', 'surecart' ),
640 ),
641 ),
642 'RU' => array(
643 'state' => array(
644 'label' => __( 'Region', 'surecart' ),
645 ),
646 ),
647 'SM' => array(
648 'postcode' => array(
649 'priority' => 65,
650 ),
651 ),
652 'KR' => array(
653 'postcode' => array(
654 'priority' => 50,
655 ),
656 'city' => array(
657 'priority' => 80,
658 ),
659 'state' => array(
660 'priority' => 70,
661 'label' => __( 'Province', 'surecart' ),
662 ),
663 'address_1' => array(
664 'priority' => 90,
665 ),
666 ),
667 'SA' => array(
668 'state' => array(
669 'label' => __( 'Region', 'surecart' ),
670 ),
671 ),
672 'SN' => array(
673 'postcode' => array(
674 'priority' => 65,
675 ),
676 ),
677 'SD' => array(
678 'postcode' => array(
679 'priority' => 65,
680 ),
681 ),
682 'SK' => array(
683 'postcode' => array(
684 'priority' => 65,
685 ),
686 ),
687 'SI' => array(
688 'postcode' => array(
689 'priority' => 65,
690 ),
691 ),
692 'SV' => array(
693 'postcode' => array(
694 'priority' => 80,
695 ),
696 'state' => array(
697 'priority' => 90,
698 'label' => __( 'Region', 'surecart' ),
699 ),
700 ),
701 'SJ' => array(
702 'postcode' => array(
703 'priority' => 65,
704 ),
705 ),
706 'TJ' => array(
707 'postcode' => array(
708 'priority' => 65,
709 ),
710 ),
711 'TH' => array(
712 'state' => array(
713 'label' => __( 'Province', 'surecart' ),
714 ),
715 ),
716 'TM' => array(
717 'postcode' => array(
718 'priority' => 65,
719 ),
720 'city' => array(
721 'priority' => 70,
722 ),
723 'name' => array(
724 'priority' => 75,
725 ),
726 'address_1' => array(
727 'priority' => 80,
728 ),
729 ),
730 'ES' => array(
731 'postcode' => array(
732 'priority' => 65,
733 ),
734 'state' => array(
735 'label' => __( 'Province', 'surecart' ),
736 ),
737 ),
738 'FO' => array(
739 'postcode' => array(
740 'priority' => 65,
741 ),
742 ),
743 'LI' => array(
744 'postcode' => array(
745 'priority' => 65,
746 ),
747 ),
748 'MD' => array(
749 'postcode' => array(
750 'priority' => 65,
751 ),
752 'state' => array(
753 'label' => __( 'Municipality / District', 'surecart' ),
754 ),
755 ),
756 'MC' => array(
757 'postcode' => array(
758 'priority' => 65,
759 ),
760 ),
761 'ME' => array(
762 'postcode' => array(
763 'priority' => 65,
764 ),
765 ),
766 'SE' => array(
767 'postcode' => array(
768 'priority' => 65,
769 ),
770 ),
771 'TR' => array(
772 'postcode' => array(
773 'priority' => 65,
774 ),
775 'state' => array(
776 'label' => __( 'Province', 'surecart' ),
777 ),
778 ),
779 'UG' => array(
780 'city' => array(
781 'label' => __( 'Town / Village', 'surecart' ),
782 ),
783 'state' => array(
784 'label' => __( 'District', 'surecart' ),
785 ),
786 ),
787 'US' => array(
788 'postcode' => array(
789 'label' => __( 'ZIP Code', 'surecart' ),
790 ),
791 'state' => array(
792 'label' => __( 'State', 'surecart' ),
793 ),
794 ),
795 'UY' => array(
796 'postcode' => array(
797 'priority' => 65,
798 ),
799 'state' => array(
800 'label' => __( 'Region', 'surecart' ),
801 ),
802 ),
803 'AE' => array(
804 'state' => array(
805 'label' => __( 'Emirate', 'surecart' ),
806 ),
807 ),
808 'GB' => array(
809 'postcode' => array(
810 'label' => __( 'Postcode', 'surecart' ),
811 ),
812 'state' => array(
813 'label' => __( 'County', 'surecart' ),
814 ),
815 ),
816 'ST' => array(
817 'state' => array(
818 'label' => __( 'District', 'surecart' ),
819 ),
820 ),
821 'VE' => array(
822 'postcode' => array(
823 'priority' => 75,
824 ),
825 'state' => array(
826 'label' => __( 'State', 'surecart' ),
827 ),
828 ),
829 'VN' => array(
830 'postcode' => array(
831 'priority' => 75,
832 ),
833 'state' => array(
834 'label' => __( 'Province', 'surecart' ),
835 ),
836 ),
837 'WF' => array(
838 'postcode' => array(
839 'priority' => 65,
840 ),
841 ),
842 'ZM' => array(
843 'postcode' => array(
844 'priority' => 65,
845 ),
846 ),
847 'ZA' => array(
848 'state' => array(
849 'label' => __( 'Province', 'surecart' ),
850 ),
851 ),
852 )
853 );
854 }
855 }
856