blob: b2e8cce7f9087a580036f0c295a1bb82ded31992 [file] [log] [blame]
swissChilif0cbdc32023-01-05 17:21:38 -05001<?php
2
3if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly.
5}
6
7/**
8 * Class WC_Stripe_Hong_Kong_States
9 *
10 * Contains a list of districts (equivalent to WC states) in Hong Kong used for normalization and validation purposes.
11 * This is necessary due to a bug in Apple Pay that's currently being worked on. Until
12 * that bug is fixed this workaround will be necessary.
13 *
14 * More info in pc4etw-bY-p2.
15 *
16 * @since 5.8.0
17 */
18class WC_Stripe_Hong_Kong_States {
19 // Source: https://www.rvd.gov.hk/doc/tc/hkpr13/06.pdf
20 const STATES = [
21 'hong kong',
22 '港島',
23
24 'central and western',
25 '中西區',
26
27 'kennedy town',
28 'shek tong tsui',
29 'sai ying pun',
30 'sheung wan',
31 'central',
32 'admiralty',
33 'mid-levels',
34 'peak',
35 '堅尼地城',
36 '石塘咀',
37 '西營盤',
38 '上環',
39 '中環',
40 '金鐘',
41 '半山區',
42 '山頂',
43
44 'wan chai',
45 '灣仔',
46
47 'causeway bay',
48 'happy valley',
49 'tai hang',
50 'so kon po',
51 "jardine's lookout",
52 '灣仔',
53 '銅鑼灣',
54 '跑馬地',
55 '大坑',
56 '掃桿埔',
57 '渣甸山',
58
59 'eastern',
60 '東區',
61
62 'tin hau',
63 'braemar hill',
64 'north point',
65 'quarry bay',
66 'sai wan ho',
67 'shau kei wan',
68 'chai wan',
69 'siu sai wan',
70 '天后',
71 '寶馬山',
72 '北角',
73 '鰂魚涌',
74 '西灣河',
75 '筲箕灣',
76 '柴灣',
77 '小西灣',
78
79 'southern',
80 '南區',
81
82 'pok fu lam',
83 'aberdeen',
84 'ap lei chau',
85 'wong chuk hang',
86 'shouson hill',
87 'repulse bay',
88 'chung hom kok',
89 'stanley',
90 'tai tam',
91 'shek o',
92 '薄扶林',
93 '香港仔',
94 '鴨脷洲',
95 '黃竹坑',
96 '壽臣山',
97 '淺水灣',
98 '舂磡角',
99 '赤柱',
100 '大潭',
101 '石澳',
102
103 'kowloon',
104 '九龍',
105
106 'yau tsim mong',
107 '油尖旺',
108
109 'tsim sha tsui',
110 'yau ma tei',
111 'west kowloon reclamation',
112 "king's park, mong kok",
113 'tai kok tsui',
114 '尖沙咀',
115 '油麻地',
116 '西九龍填海區',
117 '京士柏',
118 '旺角',
119 '大角咀',
120
121 'sham shui po',
122 '深水埗',
123
124 'mei foo',
125 'lai chi kok',
126 'cheung sha wan',
127 'shek kip mei',
128 'yau yat tsuen',
129 'tai wo ping',
130 'stonecutters island',
131 '美孚',
132 '荔枝角',
133 '長沙灣',
134 '石硤尾',
135 '又一村',
136 '大窩坪',
137 '昂船洲',
138
139 'kowloon city',
140 '九龍城',
141
142 'hung hom',
143 'to kwa wan',
144 'ma tau kok',
145 'ma tau wai',
146 'kai tak',
147 'ho man tin',
148 'kowloon tong',
149 'beacon hill',
150 '紅磡',
151 '土瓜灣',
152 '馬頭角',
153 '馬頭圍',
154 '啟德',
155 '何文田',
156 '九龍塘',
157 '筆架山',
158
159 'wong tai sin',
160 '黃大仙',
161
162 'san po kong',
163 'tung tau',
164 'wang tau hom',
165 'lok fu',
166 'diamond hill',
167 'tsz wan shan',
168 'ngau chi wan',
169 '新蒲崗',
170 '東頭',
171 '橫頭磡',
172 '樂富',
173 '鑽石山',
174 '慈雲山',
175 '牛池灣',
176
177 'kwun tong',
178 '觀塘',
179
180 'ping shek',
181 'kowloon bay',
182 'ngau tau kok',
183 'jordan valley',
184 'kwun tong',
185 'sau mau ping',
186 'lam tin',
187 'yau tong',
188 'lei yue mun',
189 '坪石',
190 '九龍灣',
191 '牛頭角',
192 '佐敦谷',
193 '觀塘',
194 '秀茂坪',
195 '藍田',
196 '油塘',
197 '鯉魚門',
198
199 'new territories',
200 '新界',
201
202 'kwai tsing',
203 '葵青',
204
205 'kwai chung',
206 'tsing yi',
207 '葵涌',
208 '青衣',
209
210 'tsuen wan',
211 '荃灣',
212
213 'lei muk shue',
214 'ting kau',
215 'sham tseng',
216 'tsing lung tau',
217 'ma wan',
218 'sunny bay',
219 '梨木樹',
220 '汀九',
221 '深井',
222 '青龍頭',
223 '馬灣',
224 '欣澳',
225
226 'tuen mun',
227 '屯門',
228
229 'tai lam chung',
230 'so kwun wat',
231 'tuen mun',
232 'lam tei',
233 '大欖涌',
234 '掃管笏',
235 '屯門',
236 '藍地',
237
238 'yuen long',
239 '元朗',
240
241 'hung shui kiu',
242 'ha tsuen',
243 'lau fau shan',
244 'tin shui wai',
245 'yuen long',
246 'san tin',
247 'lok ma chau',
248 'kam tin',
249 'shek kong',
250 'pat heung',
251 '洪水橋',
252 '廈村',
253 '流浮山',
254 '天水圍',
255 '元朗',
256 '新田',
257 '落馬洲',
258 '錦田',
259 '石崗',
260 '八鄉',
261
262 'north',
263 '北區',
264
265 'fanling',
266 'luen wo hui',
267 'sheung shui',
268 'shek wu hui',
269 'sha tau kok',
270 'luk keng',
271 'wu kau tang',
272 '粉嶺',
273 '聯和墟',
274 '上水',
275 '石湖墟',
276 '沙頭角',
277 '鹿頸',
278 '烏蛟騰',
279
280 'tai po',
281 '大埔',
282
283 'tai po market',
284 'tai po kau',
285 'tai mei tuk',
286 'shuen wan',
287 'cheung muk tau',
288 'kei ling ha',
289 '大埔墟',
290 '大埔',
291 '大埔滘',
292 '大尾篤',
293 '船灣',
294 '樟木頭',
295 '企嶺下',
296
297 'sha tin',
298 '沙田',
299
300 'tai wai',
301 'fo tan',
302 'ma liu shui',
303 'wu kai sha',
304 'ma on shan',
305 '大圍',
306 '火炭',
307 '馬料水',
308 '烏溪沙',
309 '馬鞍山',
310
311 'sai kung',
312 '西貢',
313
314 'clear water bay',
315 'tai mong tsai',
316 'tseung kwan o',
317 'hang hau',
318 'tiu keng leng',
319 'ma yau tong',
320 '清水灣',
321 '大網仔',
322 '將軍澳',
323 '坑口',
324 '調景嶺',
325 '馬游塘',
326
327 'islands',
328 '離島',
329
330 'cheung chau',
331 'peng chau',
332 'lantau island (including tung chung)',
333 'lamma island',
334 '長洲',
335 '坪洲',
336 '大嶼山(包括東涌)',
337 '南丫島',
338 ];
339
340 /**
341 * Checks if the given state is a valid region (equivalent to WC state) in Hong Kong.
342 *
343 * @param string $state The state to be evaluated.
344 * @return bool True if the provided state is valid, false otherwise.
345 */
346 public static function is_valid_state( $state ) {
347 return in_array( $state, self::STATES, true );
348 }
349}