|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Currency Functions |
|
4
|
|
|
* |
|
5
|
|
|
* @package Give |
|
6
|
|
|
* @subpackage Functions |
|
7
|
|
|
* @copyright Copyright (c) 2017, WordImpress |
|
8
|
|
|
* @license https://opensource.org/licenses/gpl-license GNU Public License |
|
9
|
|
|
* @since 1.8.17 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Get the set currency |
|
14
|
|
|
* |
|
15
|
|
|
* @since 1.0 |
|
16
|
|
|
* @since 1.8.15 Upgrade function to handle dynamic currency |
|
17
|
|
|
* |
|
18
|
|
|
* @param int $donation_or_form_id Donation or Form ID |
|
19
|
|
|
* @param array|object $args Additional data |
|
20
|
|
|
* |
|
21
|
|
|
* @return string The currency code |
|
22
|
|
|
*/ |
|
23
|
|
|
function give_get_currency( $donation_or_form_id = null, $args = array() ) { |
|
24
|
|
|
|
|
25
|
|
|
// Get currency from donation |
|
26
|
|
|
if ( is_numeric( $donation_or_form_id ) && 'give_payment' === get_post_type( $donation_or_form_id ) ) { |
|
27
|
|
|
$currency = give_get_meta( $donation_or_form_id, '_give_payment_currency', true ); |
|
28
|
|
|
|
|
29
|
|
|
if ( empty( $currency ) ) { |
|
30
|
|
|
$currency = give_get_option( 'currency', 'USD' ); |
|
31
|
|
|
} |
|
32
|
|
|
} else { |
|
33
|
|
|
$currency = give_get_option( 'currency', 'USD' ); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Filter the currency on basis of donation or form id or addtional data. |
|
38
|
|
|
* |
|
39
|
|
|
* @since 1.0 |
|
40
|
|
|
*/ |
|
41
|
|
|
return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args ); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Get the set currency position |
|
46
|
|
|
* |
|
47
|
|
|
* @since 1.3.6 |
|
48
|
|
|
* |
|
49
|
|
|
* @return string The currency code |
|
50
|
|
|
*/ |
|
51
|
|
|
function give_get_currency_position() { |
|
52
|
|
|
|
|
53
|
|
|
$currency_pos = give_get_option( 'currency_position', 'before' ); |
|
54
|
|
|
|
|
55
|
|
|
return apply_filters( 'give_currency_position', $currency_pos ); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Get Currencies List |
|
60
|
|
|
* |
|
61
|
|
|
* @since 1.8.17 |
|
62
|
|
|
* |
|
63
|
|
|
* @return array $currencies A list of the available currencies |
|
64
|
|
|
*/ |
|
65
|
|
|
function give_get_currencies_list() { |
|
66
|
|
|
$currencies = array( |
|
67
|
|
|
'USD' => array( |
|
68
|
|
|
'admin_label' => sprintf( __('US Dollars (%1$s)', 'give'), '$'), |
|
|
|
|
|
|
69
|
|
|
'symbol' => '$', |
|
70
|
|
|
'setting' => array( |
|
71
|
|
|
'currency_position' => 'before', |
|
72
|
|
|
'thousands_separator' => ',', |
|
73
|
|
|
'decimal_separator' => '.', |
|
74
|
|
|
'number_decimals' => 2, |
|
75
|
|
|
), |
|
76
|
|
|
), |
|
77
|
|
|
'EUR' => array( |
|
78
|
|
|
'admin_label' => sprintf( __('Euros (%1$s)', 'give'), '€'), |
|
|
|
|
|
|
79
|
|
|
'symbol' => '€', |
|
80
|
|
|
'setting' => array( |
|
81
|
|
|
'currency_position' => 'before', |
|
82
|
|
|
'thousands_separator' => '.', |
|
83
|
|
|
'decimal_separator' => ',', |
|
84
|
|
|
'number_decimals' => 2, |
|
85
|
|
|
), |
|
86
|
|
|
), |
|
87
|
|
|
'GBP' => array( |
|
88
|
|
|
'admin_label' => sprintf( __('Pounds Sterling (%1$s)', 'give'), '£'), |
|
|
|
|
|
|
89
|
|
|
'symbol' => '£', |
|
90
|
|
|
'setting' => array( |
|
91
|
|
|
'currency_position' => 'before', |
|
92
|
|
|
'thousands_separator' => ',', |
|
93
|
|
|
'decimal_separator' => '.', |
|
94
|
|
|
'number_decimals' => 2, |
|
95
|
|
|
), |
|
96
|
|
|
), |
|
97
|
|
|
'AUD' => array( |
|
98
|
|
|
'admin_label' => sprintf( __('Australian Dollars (%1$s)', 'give'), '$'), |
|
|
|
|
|
|
99
|
|
|
'symbol' => '$', |
|
100
|
|
|
'setting' => array( |
|
101
|
|
|
'currency_position' => 'before', |
|
102
|
|
|
'thousands_separator' => ',', |
|
103
|
|
|
'decimal_separator' => '.', |
|
104
|
|
|
'number_decimals' => 2, |
|
105
|
|
|
), |
|
106
|
|
|
), |
|
107
|
|
|
'BRL' => array( |
|
108
|
|
|
'admin_label' => sprintf( __('Brazilian Real (%1$s)', 'give'), 'R$'), |
|
|
|
|
|
|
109
|
|
|
'symbol' => 'R$', |
|
110
|
|
|
'setting' => array( |
|
111
|
|
|
'currency_position' => 'before', |
|
112
|
|
|
'thousands_separator' => ',', |
|
113
|
|
|
'decimal_separator' => '.', |
|
114
|
|
|
'number_decimals' => 2, |
|
115
|
|
|
), |
|
116
|
|
|
), |
|
117
|
|
|
'CAD' => array( |
|
118
|
|
|
'admin_label' => sprintf( __('Canadian Dollars (%1$s)', 'give'), '$'), |
|
|
|
|
|
|
119
|
|
|
'symbol' => '$', |
|
120
|
|
|
'setting' => array( |
|
121
|
|
|
'currency_position' => 'before', |
|
122
|
|
|
'thousands_separator' => ',', |
|
123
|
|
|
'decimal_separator' => '.', |
|
124
|
|
|
'number_decimals' => 2, |
|
125
|
|
|
), |
|
126
|
|
|
), |
|
127
|
|
|
'CZK' => array( |
|
128
|
|
|
'admin_label' => sprintf( __('Czech Koruna (%1$s)', 'give'), 'Kč'), |
|
|
|
|
|
|
129
|
|
|
'symbol' => 'Kč', |
|
130
|
|
|
'setting' => array( |
|
131
|
|
|
'currency_position' => 'after', |
|
132
|
|
|
'thousands_separator' => ',', |
|
133
|
|
|
'decimal_separator' => '.', |
|
134
|
|
|
'number_decimals' => 2, |
|
135
|
|
|
), |
|
136
|
|
|
), |
|
137
|
|
|
'DKK' => array( |
|
138
|
|
|
'admin_label' => sprintf( __('Danish Krone (%1$s)', 'give'), ' kr. '), |
|
|
|
|
|
|
139
|
|
|
'symbol' => ' kr. ', |
|
140
|
|
|
'setting' => array( |
|
141
|
|
|
'currency_position' => 'before', |
|
142
|
|
|
'thousands_separator' => ',', |
|
143
|
|
|
'decimal_separator' => '.', |
|
144
|
|
|
'number_decimals' => 2, |
|
145
|
|
|
), |
|
146
|
|
|
), |
|
147
|
|
|
'HKD' => array( |
|
148
|
|
|
'admin_label' => sprintf( __('Hong Kong Dollar (%1$s)', 'give'), '$'), |
|
|
|
|
|
|
149
|
|
|
'symbol' => '$', |
|
150
|
|
|
'setting' => array( |
|
151
|
|
|
'currency_position' => 'before', |
|
152
|
|
|
'thousands_separator' => ',', |
|
153
|
|
|
'decimal_separator' => '.', |
|
154
|
|
|
'number_decimals' => 2, |
|
155
|
|
|
), |
|
156
|
|
|
), |
|
157
|
|
|
'HUF' => array( |
|
158
|
|
|
'admin_label' => sprintf( __('Hungarian Forint (%1$s)', 'give'), 'Ft'), |
|
|
|
|
|
|
159
|
|
|
'symbol' => 'Ft', |
|
160
|
|
|
'setting' => array( |
|
161
|
|
|
'currency_position' => 'after', |
|
162
|
|
|
'thousands_separator' => ',', |
|
163
|
|
|
'decimal_separator' => '.', |
|
164
|
|
|
'number_decimals' => 2, |
|
165
|
|
|
), |
|
166
|
|
|
), |
|
167
|
|
|
'ILS' => array( |
|
168
|
|
|
'admin_label' => sprintf( __('Israeli Shekel (%1$s)', 'give'), '₪'), |
|
|
|
|
|
|
169
|
|
|
'symbol' => '₪', |
|
170
|
|
|
'setting' => array( |
|
171
|
|
|
'currency_position' => 'after', |
|
172
|
|
|
'thousands_separator' => ',', |
|
173
|
|
|
'decimal_separator' => '.', |
|
174
|
|
|
'number_decimals' => 2, |
|
175
|
|
|
), |
|
176
|
|
|
), |
|
177
|
|
|
'JPY' => array( |
|
178
|
|
|
'admin_label' => sprintf( __('Japanese Yen (%1$s)', 'give'), '¥'), |
|
|
|
|
|
|
179
|
|
|
'symbol' => '¥', |
|
180
|
|
|
'setting' => array( |
|
181
|
|
|
'currency_position' => 'before', |
|
182
|
|
|
'thousands_separator' => ',', |
|
183
|
|
|
'decimal_separator' => '.', |
|
184
|
|
|
'number_decimals' => 0, |
|
185
|
|
|
), |
|
186
|
|
|
), |
|
187
|
|
|
'MYR' => array( |
|
188
|
|
|
'admin_label' => sprintf( __('Malaysian Ringgits (%1$s)', 'give'), 'RM'), |
|
|
|
|
|
|
189
|
|
|
'symbol' => 'RM', |
|
190
|
|
|
'setting' => array( |
|
191
|
|
|
'currency_position' => 'before', |
|
192
|
|
|
'thousands_separator' => ',', |
|
193
|
|
|
'decimal_separator' => '.', |
|
194
|
|
|
'number_decimals' => 2, |
|
195
|
|
|
), |
|
196
|
|
|
), |
|
197
|
|
|
'MXN' => array( |
|
198
|
|
|
'admin_label' => sprintf( __('Mexican Peso (%1$s)', 'give'), '$'), |
|
|
|
|
|
|
199
|
|
|
'symbol' => '$', |
|
200
|
|
|
'setting' => array( |
|
201
|
|
|
'currency_position' => 'before', |
|
202
|
|
|
'thousands_separator' => ',', |
|
203
|
|
|
'decimal_separator' => '.', |
|
204
|
|
|
'number_decimals' => 2, |
|
205
|
|
|
), |
|
206
|
|
|
), |
|
207
|
|
|
'MAD' => array( |
|
208
|
|
|
'admin_label' => sprintf( __('Moroccan Dirham (%1$s)', 'give'), '.د.م'), |
|
|
|
|
|
|
209
|
|
|
'symbol' => '.د.م', |
|
210
|
|
|
'setting' => array( |
|
211
|
|
|
'currency_position' => 'before', |
|
212
|
|
|
'thousands_separator' => ',', |
|
213
|
|
|
'decimal_separator' => '.', |
|
214
|
|
|
'number_decimals' => 2, |
|
215
|
|
|
), |
|
216
|
|
|
), |
|
217
|
|
|
'NZD' => array( |
|
218
|
|
|
'admin_label' => sprintf( __('New Zealand Dollar (%1$s)', 'give'), '$'), |
|
|
|
|
|
|
219
|
|
|
'symbol' => '$', |
|
220
|
|
|
'setting' => array( |
|
221
|
|
|
'currency_position' => 'before', |
|
222
|
|
|
'thousands_separator' => ',', |
|
223
|
|
|
'decimal_separator' => '.', |
|
224
|
|
|
'number_decimals' => 2, |
|
225
|
|
|
), |
|
226
|
|
|
), |
|
227
|
|
|
'NOK' => array( |
|
228
|
|
|
'admin_label' => sprintf( __('Norwegian Krone (%1$s)', 'give'), 'kr.'), |
|
|
|
|
|
|
229
|
|
|
'symbol' => 'kr.', |
|
230
|
|
|
'setting' => array( |
|
231
|
|
|
'currency_position' => 'before', |
|
232
|
|
|
'thousands_separator' => '.', |
|
233
|
|
|
'decimal_separator' => ',', |
|
234
|
|
|
'number_decimals' => 2, |
|
235
|
|
|
), |
|
236
|
|
|
), |
|
237
|
|
|
'PHP' => array( |
|
238
|
|
|
'admin_label' => sprintf( __('Philippine Pesos (%1$s)', 'give'), '₱'), |
|
|
|
|
|
|
239
|
|
|
'symbol' => '₱', |
|
240
|
|
|
'setting' => array( |
|
241
|
|
|
'currency_position' => 'before', |
|
242
|
|
|
'thousands_separator' => ',', |
|
243
|
|
|
'decimal_separator' => '.', |
|
244
|
|
|
'number_decimals' => 2, |
|
245
|
|
|
), |
|
246
|
|
|
), |
|
247
|
|
|
'PLN' => array( |
|
248
|
|
|
'admin_label' => sprintf( __('Polish Zloty (%1$s)', 'give'), 'zł'), |
|
|
|
|
|
|
249
|
|
|
'symbol' => 'zł', |
|
250
|
|
|
'setting' => array( |
|
251
|
|
|
'currency_position' => 'after', |
|
252
|
|
|
'thousands_separator' => ' ', |
|
253
|
|
|
'decimal_separator' => ',', |
|
254
|
|
|
'number_decimals' => 2, |
|
255
|
|
|
), |
|
256
|
|
|
), |
|
257
|
|
|
'SGD' => array( |
|
258
|
|
|
'admin_label' => sprintf( __('Singapore Dollar (%1$s)', 'give'), '$'), |
|
|
|
|
|
|
259
|
|
|
'symbol' => '$', |
|
260
|
|
|
'setting' => array( |
|
261
|
|
|
'currency_position' => 'before', |
|
262
|
|
|
'thousands_separator' => ',', |
|
263
|
|
|
'decimal_separator' => '.', |
|
264
|
|
|
'number_decimals' => 2, |
|
265
|
|
|
), |
|
266
|
|
|
), |
|
267
|
|
|
'KRW' => array( |
|
268
|
|
|
'admin_label' => sprintf( __('South Korean Won (%1$s)', 'give'), '₩'), |
|
|
|
|
|
|
269
|
|
|
'symbol' => '₩', |
|
270
|
|
|
'setting' => array( |
|
271
|
|
|
'currency_position' => 'before', |
|
272
|
|
|
'thousands_separator' => ',', |
|
273
|
|
|
'decimal_separator' => '.', |
|
274
|
|
|
'number_decimals' => 0, |
|
275
|
|
|
), |
|
276
|
|
|
), |
|
277
|
|
|
'ZAR' => array( |
|
278
|
|
|
'admin_label' => sprintf( __('South African Rand (%1$s)', 'give'), 'R'), |
|
|
|
|
|
|
279
|
|
|
'symbol' => 'R', |
|
280
|
|
|
'setting' => array( |
|
281
|
|
|
'currency_position' => 'before', |
|
282
|
|
|
'thousands_separator' => ' ', |
|
283
|
|
|
'decimal_separator' => '.', |
|
284
|
|
|
'number_decimals' => 2, |
|
285
|
|
|
), |
|
286
|
|
|
), |
|
287
|
|
|
'SEK' => array( |
|
288
|
|
|
'admin_label' => sprintf( __('Swedish Krona (%1$s)', 'give'), ' kr. '), |
|
|
|
|
|
|
289
|
|
|
'symbol' => ' kr. ', |
|
290
|
|
|
'setting' => array( |
|
291
|
|
|
'currency_position' => 'before', |
|
292
|
|
|
'thousands_separator' => ' ', |
|
293
|
|
|
'decimal_separator' => ',', |
|
294
|
|
|
'number_decimals' => 2, |
|
295
|
|
|
), |
|
296
|
|
|
), |
|
297
|
|
|
'CHF' => array( |
|
298
|
|
|
'admin_label' => sprintf( __('Swiss Franc (%1$s)', 'give'), 'Fr'), |
|
|
|
|
|
|
299
|
|
|
'symbol' => 'Fr', |
|
300
|
|
|
'setting' => array( |
|
301
|
|
|
'currency_position' => 'before', |
|
302
|
|
|
'thousands_separator' => ',', |
|
303
|
|
|
'decimal_separator' => '.', |
|
304
|
|
|
'number_decimals' => 2, |
|
305
|
|
|
), |
|
306
|
|
|
), |
|
307
|
|
|
'TWD' => array( |
|
308
|
|
|
'admin_label' => sprintf( __('Taiwan New Dollars (%1$s)', 'give'), 'NT$'), |
|
|
|
|
|
|
309
|
|
|
'symbol' => 'NT$', |
|
310
|
|
|
'setting' => array( |
|
311
|
|
|
'currency_position' => 'before', |
|
312
|
|
|
'thousands_separator' => '\'', |
|
313
|
|
|
'decimal_separator' => '.', |
|
314
|
|
|
'number_decimals' => 2, |
|
315
|
|
|
), |
|
316
|
|
|
), |
|
317
|
|
|
'THB' => array( |
|
318
|
|
|
'admin_label' => sprintf( __('Thai Baht (%1$s)', 'give'), '฿'), |
|
|
|
|
|
|
319
|
|
|
'symbol' => '฿', |
|
320
|
|
|
'setting' => array( |
|
321
|
|
|
'currency_position' => 'before', |
|
322
|
|
|
'thousands_separator' => ',', |
|
323
|
|
|
'decimal_separator' => '.', |
|
324
|
|
|
'number_decimals' => 2, |
|
325
|
|
|
), |
|
326
|
|
|
), |
|
327
|
|
|
'INR' => array( |
|
328
|
|
|
'admin_label' => sprintf( __('Indian Rupee (%1$s)', 'give'), '₹'), |
|
|
|
|
|
|
329
|
|
|
'symbol' => '₹', |
|
330
|
|
|
'setting' => array( |
|
331
|
|
|
'currency_position' => 'before', |
|
332
|
|
|
'thousands_separator' => ',', |
|
333
|
|
|
'decimal_separator' => '.', |
|
334
|
|
|
'number_decimals' => 2, |
|
335
|
|
|
), |
|
336
|
|
|
), |
|
337
|
|
|
'TRY' => array( |
|
338
|
|
|
'admin_label' => sprintf( __('Turkish Lira (%1$s)', 'give'), '₺'), |
|
|
|
|
|
|
339
|
|
|
'symbol' => '₺', |
|
340
|
|
|
'setting' => array( |
|
341
|
|
|
'currency_position' => 'after', |
|
342
|
|
|
'thousands_separator' => ',', |
|
343
|
|
|
'decimal_separator' => '.', |
|
344
|
|
|
'number_decimals' => 2, |
|
345
|
|
|
), |
|
346
|
|
|
), |
|
347
|
|
|
'IRR' => array( |
|
348
|
|
|
'admin_label' => sprintf( __('Iranian Rial (%1$s)', 'give'), '﷼'), |
|
|
|
|
|
|
349
|
|
|
'symbol' => '﷼', |
|
350
|
|
|
'setting' => array( |
|
351
|
|
|
'currency_position' => 'after', |
|
352
|
|
|
'thousands_separator' => ',', |
|
353
|
|
|
'decimal_separator' => '.', |
|
354
|
|
|
'number_decimals' => 2, |
|
355
|
|
|
), |
|
356
|
|
|
), |
|
357
|
|
|
'RUB' => array( |
|
358
|
|
|
'admin_label' => sprintf( __('Russian Rubles (%1$s)', 'give'), '₽'), |
|
|
|
|
|
|
359
|
|
|
'symbol' => '₽', |
|
360
|
|
|
'setting' => array( |
|
361
|
|
|
'currency_position' => 'before', |
|
362
|
|
|
'thousands_separator' => '.', |
|
363
|
|
|
'decimal_separator' => ',', |
|
364
|
|
|
'number_decimals' => 2, |
|
365
|
|
|
), |
|
366
|
|
|
), |
|
367
|
|
|
'AED' => array( |
|
368
|
|
|
'admin_label' => sprintf( __('United Arab Emirates dirham (%1$s)', 'give'), 'د.إ'), |
|
|
|
|
|
|
369
|
|
|
'symbol' => 'د.إ', |
|
370
|
|
|
'setting' => array( |
|
371
|
|
|
'currency_position' => 'before', |
|
372
|
|
|
'thousands_separator' => ',', |
|
373
|
|
|
'decimal_separator' => '.', |
|
374
|
|
|
'number_decimals' => 2, |
|
375
|
|
|
), |
|
376
|
|
|
), |
|
377
|
|
|
'AMD' => array( |
|
378
|
|
|
'admin_label' => sprintf( __('Armenian dram (%1$s)', 'give'), 'AMD'), |
|
|
|
|
|
|
379
|
|
|
'symbol' => 'AMD', // Add backward compatibility. Using AMD in place of ֏ |
|
380
|
|
|
'setting' => array( |
|
381
|
|
|
'currency_position' => 'before', |
|
382
|
|
|
'thousands_separator' => ',', |
|
383
|
|
|
'decimal_separator' => '.', |
|
384
|
|
|
'number_decimals' => 2, |
|
385
|
|
|
), |
|
386
|
|
|
), |
|
387
|
|
|
'ANG' => array( |
|
388
|
|
|
'admin_label' => sprintf( __('Netherlands Antillean guilder (%1$s)', 'give'), 'ƒ'), |
|
|
|
|
|
|
389
|
|
|
'symbol' => 'ƒ', |
|
390
|
|
|
'setting' => array( |
|
391
|
|
|
'currency_position' => 'before', |
|
392
|
|
|
'thousands_separator' => '.', |
|
393
|
|
|
'decimal_separator' => ',', |
|
394
|
|
|
'number_decimals' => 2, |
|
395
|
|
|
), |
|
396
|
|
|
), |
|
397
|
|
|
'ARS' => array( |
|
398
|
|
|
'admin_label' => sprintf( __('Argentine peso (%1$s)', 'give'), '$'), |
|
|
|
|
|
|
399
|
|
|
'symbol' => '$', |
|
400
|
|
|
'setting' => array( |
|
401
|
|
|
'currency_position' => 'before', |
|
402
|
|
|
'thousands_separator' => '.', |
|
403
|
|
|
'decimal_separator' => ',', |
|
404
|
|
|
'number_decimals' => 2, |
|
405
|
|
|
), |
|
406
|
|
|
), |
|
407
|
|
|
'AWG' => array( |
|
408
|
|
|
'admin_label' => sprintf( __( 'Aruban florin (%1$s)', 'give' ), 'ƒ' ), |
|
409
|
|
|
'symbol' => 'ƒ', |
|
410
|
|
|
'setting' => array( |
|
411
|
|
|
'currency_position' => 'before', |
|
412
|
|
|
'thousands_separator' => ',', |
|
413
|
|
|
'decimal_separator' => '.', |
|
414
|
|
|
'number_decimals' => 2, |
|
415
|
|
|
), |
|
416
|
|
|
), |
|
417
|
|
|
'BAM' => array( |
|
418
|
|
|
'admin_label' => sprintf( __( 'Bosnia and Herzegovina convertible mark (%1$s)', 'give' ), 'KM' ), |
|
419
|
|
|
'symbol' => 'KM', |
|
420
|
|
|
'setting' => array( |
|
421
|
|
|
'currency_position' => 'before', |
|
422
|
|
|
'thousands_separator' => ',', |
|
423
|
|
|
'decimal_separator' => '.', |
|
424
|
|
|
'number_decimals' => 2, |
|
425
|
|
|
), |
|
426
|
|
|
), |
|
427
|
|
|
'BDT' => array( |
|
428
|
|
|
'admin_label' => sprintf( __( 'Bangladeshi taka (%1$s)', 'give' ), '৳' ), |
|
429
|
|
|
'symbol' => '৳', |
|
430
|
|
|
'setting' => array( |
|
431
|
|
|
'currency_position' => 'before', |
|
432
|
|
|
'thousands_separator' => ',', |
|
433
|
|
|
'decimal_separator' => '.', |
|
434
|
|
|
'number_decimals' => 2, |
|
435
|
|
|
), |
|
436
|
|
|
), |
|
437
|
|
|
'BHD' => array( |
|
438
|
|
|
'admin_label' => sprintf( __( 'Bahraini dinar (%1$s)', 'give' ), '.د.ب' ), |
|
439
|
|
|
'symbol' => '.د.ب', |
|
440
|
|
|
'setting' => array( |
|
441
|
|
|
'currency_position' => 'before', |
|
442
|
|
|
'thousands_separator' => ',', |
|
443
|
|
|
'decimal_separator' => '.', |
|
444
|
|
|
'number_decimals' => 3, |
|
445
|
|
|
), |
|
446
|
|
|
), |
|
447
|
|
|
'BMD' => array( |
|
448
|
|
|
'admin_label' => sprintf( __( 'Bermudian dollar (%1$s)', 'give' ), 'BD$' ), |
|
449
|
|
|
'symbol' => 'BD$', |
|
450
|
|
|
'setting' => array( |
|
451
|
|
|
'currency_position' => 'before', |
|
452
|
|
|
'thousands_separator' => ',', |
|
453
|
|
|
'decimal_separator' => '.', |
|
454
|
|
|
'number_decimals' => 2, |
|
455
|
|
|
), |
|
456
|
|
|
), |
|
457
|
|
|
'BND' => array( |
|
458
|
|
|
'admin_label' => sprintf( __( 'Brunei dollar (%1$s)', 'give' ), 'B$' ), |
|
459
|
|
|
'symbol' => 'B$', |
|
460
|
|
|
'setting' => array( |
|
461
|
|
|
'currency_position' => 'before', |
|
462
|
|
|
'thousands_separator' => ',', |
|
463
|
|
|
'decimal_separator' => '.', |
|
464
|
|
|
'number_decimals' => 2, |
|
465
|
|
|
), |
|
466
|
|
|
), |
|
467
|
|
|
'BOB' => array( |
|
468
|
|
|
'admin_label' => sprintf( __( 'Bolivian boliviano (%1$s)', 'give' ), 'Bs.' ), |
|
469
|
|
|
'symbol' => 'Bs.', |
|
470
|
|
|
'setting' => array( |
|
471
|
|
|
'currency_position' => 'before', |
|
472
|
|
|
'thousands_separator' => ',', |
|
473
|
|
|
'decimal_separator' => '.', |
|
474
|
|
|
'number_decimals' => 2, |
|
475
|
|
|
), |
|
476
|
|
|
), |
|
477
|
|
|
'BSD' => array( |
|
478
|
|
|
'admin_label' => sprintf( __( 'Bahamian dollar (%1$s)', 'give' ), 'B$' ), |
|
479
|
|
|
'symbol' => 'B$', |
|
480
|
|
|
'setting' => array( |
|
481
|
|
|
'currency_position' => 'before', |
|
482
|
|
|
'thousands_separator' => ',', |
|
483
|
|
|
'decimal_separator' => '.', |
|
484
|
|
|
'number_decimals' => 2, |
|
485
|
|
|
), |
|
486
|
|
|
), |
|
487
|
|
|
'BWP' => array( |
|
488
|
|
|
'admin_label' => sprintf( __( 'Botswana pula (%1$s)', 'give' ), 'P' ), |
|
489
|
|
|
'symbol' => 'P', |
|
490
|
|
|
'setting' => array( |
|
491
|
|
|
'currency_position' => 'before', |
|
492
|
|
|
'thousands_separator' => ',', |
|
493
|
|
|
'decimal_separator' => '.', |
|
494
|
|
|
'number_decimals' => 2, |
|
495
|
|
|
), |
|
496
|
|
|
), |
|
497
|
|
|
'BZD' => array( |
|
498
|
|
|
'admin_label' => sprintf( __( 'Belizean dollar (%1$s)', 'give' ), 'BZ$' ), |
|
499
|
|
|
'symbol' => 'BZ$', |
|
500
|
|
|
'setting' => array( |
|
501
|
|
|
'currency_position' => 'before', |
|
502
|
|
|
'thousands_separator' => ',', |
|
503
|
|
|
'decimal_separator' => '.', |
|
504
|
|
|
'number_decimals' => 2, |
|
505
|
|
|
), |
|
506
|
|
|
), |
|
507
|
|
|
'CLP' => array( |
|
508
|
|
|
'admin_label' => sprintf( __( 'Chilean peso (%1$s)', 'give' ), '$' ), |
|
509
|
|
|
'symbol' => '$', |
|
510
|
|
|
'setting' => array( |
|
511
|
|
|
'currency_position' => 'before', |
|
512
|
|
|
'thousands_separator' => '.', |
|
513
|
|
|
'decimal_separator' => '', |
|
514
|
|
|
'number_decimals' => 0, |
|
515
|
|
|
), |
|
516
|
|
|
), |
|
517
|
|
|
'CNY' => array( |
|
518
|
|
|
'admin_label' => sprintf( __( 'Chinese yuan (%1$s)', 'give' ), '¥' ), |
|
519
|
|
|
'symbol' => '¥', |
|
520
|
|
|
'setting' => array( |
|
521
|
|
|
'currency_position' => 'before', |
|
522
|
|
|
'thousands_separator' => ',', |
|
523
|
|
|
'decimal_separator' => '.', |
|
524
|
|
|
'number_decimals' => 2, |
|
525
|
|
|
), |
|
526
|
|
|
), |
|
527
|
|
|
'COP' => array( |
|
528
|
|
|
'admin_label' => sprintf( __( 'Colombian peso (%1$s)', 'give' ), '$' ), |
|
529
|
|
|
'symbol' => '$', |
|
530
|
|
|
'setting' => array( |
|
531
|
|
|
'currency_position' => 'before', |
|
532
|
|
|
'thousands_separator' => '.', |
|
533
|
|
|
'decimal_separator' => ',', |
|
534
|
|
|
'number_decimals' => 2, |
|
535
|
|
|
), |
|
536
|
|
|
), |
|
537
|
|
|
'CRC' => array( |
|
538
|
|
|
'admin_label' => sprintf( __( 'Costa Rican colón (%1$s)', 'give' ), '₡' ), |
|
539
|
|
|
'symbol' => '₡', |
|
540
|
|
|
'setting' => array( |
|
541
|
|
|
'currency_position' => 'before', |
|
542
|
|
|
'thousands_separator' => '.', |
|
543
|
|
|
'decimal_separator' => ',', |
|
544
|
|
|
'number_decimals' => 2, |
|
545
|
|
|
), |
|
546
|
|
|
), |
|
547
|
|
|
'CUC' => array( |
|
548
|
|
|
'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '₱' ), |
|
549
|
|
|
'symbol' => '₱', |
|
550
|
|
|
'setting' => array( |
|
551
|
|
|
'currency_position' => 'before', |
|
552
|
|
|
'thousands_separator' => ',', |
|
553
|
|
|
'decimal_separator' => '.', |
|
554
|
|
|
'number_decimals' => 2, |
|
555
|
|
|
), |
|
556
|
|
|
), |
|
557
|
|
|
'CUP' => array( |
|
558
|
|
|
'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '₱' ), |
|
559
|
|
|
'symbol' => '₱', |
|
560
|
|
|
'setting' => array( |
|
561
|
|
|
'currency_position' => 'before', |
|
562
|
|
|
'thousands_separator' => ',', |
|
563
|
|
|
'decimal_separator' => '.', |
|
564
|
|
|
'number_decimals' => 2, |
|
565
|
|
|
), |
|
566
|
|
|
), |
|
567
|
|
|
'DOP' => array( |
|
568
|
|
|
'admin_label' => sprintf( __( 'Dominican peso (%1$s)', 'give' ), 'RD$' ), |
|
569
|
|
|
'symbol' => 'RD$', |
|
570
|
|
|
'setting' => array( |
|
571
|
|
|
'currency_position' => 'before', |
|
572
|
|
|
'thousands_separator' => ',', |
|
573
|
|
|
'decimal_separator' => '.', |
|
574
|
|
|
'number_decimals' => 2, |
|
575
|
|
|
), |
|
576
|
|
|
), |
|
577
|
|
|
'EGP' => array( |
|
578
|
|
|
'admin_label' => sprintf( __( 'Egyptian pound (%1$s)', 'give' ), 'E£' ), |
|
579
|
|
|
'symbol' => 'E£', |
|
580
|
|
|
'setting' => array( |
|
581
|
|
|
'currency_position' => 'before', |
|
582
|
|
|
'thousands_separator' => ',', |
|
583
|
|
|
'decimal_separator' => '.', |
|
584
|
|
|
'number_decimals' => 2, |
|
585
|
|
|
), |
|
586
|
|
|
), |
|
587
|
|
|
'GIP' => array( |
|
588
|
|
|
'admin_label' => sprintf( __( 'Gibraltar pound (%1$s)', 'give' ), '£' ), |
|
589
|
|
|
'symbol' => '£', |
|
590
|
|
|
'setting' => array( |
|
591
|
|
|
'currency_position' => 'before', |
|
592
|
|
|
'thousands_separator' => ',', |
|
593
|
|
|
'decimal_separator' => '.', |
|
594
|
|
|
'number_decimals' => 2, |
|
595
|
|
|
), |
|
596
|
|
|
), |
|
597
|
|
|
'GTQ' => array( |
|
598
|
|
|
'admin_label' => sprintf( __( 'Guatemalan quetzal (%1$s)', 'give' ), 'Q' ), |
|
599
|
|
|
'symbol' => 'Q', |
|
600
|
|
|
'setting' => array( |
|
601
|
|
|
'currency_position' => 'before', |
|
602
|
|
|
'thousands_separator' => ',', |
|
603
|
|
|
'decimal_separator' => '.', |
|
604
|
|
|
'number_decimals' => 2, |
|
605
|
|
|
), |
|
606
|
|
|
), |
|
607
|
|
|
'HNL' => array( |
|
608
|
|
|
'admin_label' => sprintf( __( 'Honduran lempira (%1$s)', 'give' ), 'L' ), |
|
609
|
|
|
'symbol' => 'L', |
|
610
|
|
|
'setting' => array( |
|
611
|
|
|
'currency_position' => 'before', |
|
612
|
|
|
'thousands_separator' => ',', |
|
613
|
|
|
'decimal_separator' => '.', |
|
614
|
|
|
'number_decimals' => 2, |
|
615
|
|
|
), |
|
616
|
|
|
), |
|
617
|
|
|
'HRK' => array( |
|
618
|
|
|
'admin_label' => sprintf( __( 'Croatian kuna (%1$s)', 'give' ), 'kn' ), |
|
619
|
|
|
'symbol' => 'kn', |
|
620
|
|
|
'setting' => array( |
|
621
|
|
|
'currency_position' => 'after', |
|
622
|
|
|
'thousands_separator' => '.', |
|
623
|
|
|
'decimal_separator' => ',', |
|
624
|
|
|
'number_decimals' => 2, |
|
625
|
|
|
), |
|
626
|
|
|
), |
|
627
|
|
|
'IDR' => array( |
|
628
|
|
|
'admin_label' => sprintf( __( 'Indonesian rupiah (%1$s)', 'give' ), 'Rp' ), |
|
629
|
|
|
'symbol' => 'Rp', |
|
630
|
|
|
'setting' => array( |
|
631
|
|
|
'currency_position' => 'before', |
|
632
|
|
|
'thousands_separator' => '.', |
|
633
|
|
|
'decimal_separator' => ',', |
|
634
|
|
|
'number_decimals' => 2, |
|
635
|
|
|
), |
|
636
|
|
|
), |
|
637
|
|
|
'ISK' => array( |
|
638
|
|
|
'admin_label' => sprintf( __( 'Icelandic króna (%1$s)', 'give' ), 'kr' ), |
|
639
|
|
|
'symbol' => 'kr', |
|
640
|
|
|
'setting' => array( |
|
641
|
|
|
'currency_position' => 'after', |
|
642
|
|
|
'thousands_separator' => '.', |
|
643
|
|
|
'decimal_separator' => '', |
|
644
|
|
|
'number_decimals' => 0, |
|
645
|
|
|
), |
|
646
|
|
|
), |
|
647
|
|
|
'JMD' => array( |
|
648
|
|
|
'admin_label' => sprintf( __( 'Jamaican dollar (%1$s)', 'give' ), 'j$' ), |
|
649
|
|
|
'symbol' => 'j$', |
|
650
|
|
|
'setting' => array( |
|
651
|
|
|
'currency_position' => 'before', |
|
652
|
|
|
'thousands_separator' => ',', |
|
653
|
|
|
'decimal_separator' => '.', |
|
654
|
|
|
'number_decimals' => 2, |
|
655
|
|
|
), |
|
656
|
|
|
), |
|
657
|
|
|
'JOD' => array( |
|
658
|
|
|
'admin_label' => sprintf( __( 'Jordanian dinar (%1$s)', 'give' ), 'د.ا' ), |
|
659
|
|
|
'symbol' => 'د.ا', |
|
660
|
|
|
'setting' => array( |
|
661
|
|
|
'currency_position' => 'before', |
|
662
|
|
|
'thousands_separator' => ',', |
|
663
|
|
|
'decimal_separator' => '.', |
|
664
|
|
|
'number_decimals' => 3, |
|
665
|
|
|
), |
|
666
|
|
|
), |
|
667
|
|
|
'KES' => array( |
|
668
|
|
|
'admin_label' => sprintf( __( 'Kenyan shilling (%1$s)', 'give' ), 'KSh' ), |
|
669
|
|
|
'symbol' => 'KSh', |
|
670
|
|
|
'setting' => array( |
|
671
|
|
|
'currency_position' => 'before', |
|
672
|
|
|
'thousands_separator' => ',', |
|
673
|
|
|
'decimal_separator' => '.', |
|
674
|
|
|
'number_decimals' => 2, |
|
675
|
|
|
), |
|
676
|
|
|
), |
|
677
|
|
|
'KWD' => array( |
|
678
|
|
|
'admin_label' => sprintf( __( 'Kuwaiti dinar (%1$s)', 'give' ), 'د.ك' ), |
|
679
|
|
|
'symbol' => 'د.ك', |
|
680
|
|
|
'setting' => array( |
|
681
|
|
|
'currency_position' => 'before', |
|
682
|
|
|
'thousands_separator' => ',', |
|
683
|
|
|
'decimal_separator' => '.', |
|
684
|
|
|
'number_decimals' => 3, |
|
685
|
|
|
), |
|
686
|
|
|
), |
|
687
|
|
|
'KYD' => array( |
|
688
|
|
|
'admin_label' => sprintf( __( 'Cayman Islands dollar (%1$s)', 'give' ), 'KY$' ), |
|
689
|
|
|
'symbol' => 'KY$', |
|
690
|
|
|
'setting' => array( |
|
691
|
|
|
'currency_position' => 'before', |
|
692
|
|
|
'thousands_separator' => ',', |
|
693
|
|
|
'decimal_separator' => '.', |
|
694
|
|
|
'number_decimals' => 2, |
|
695
|
|
|
), |
|
696
|
|
|
), |
|
697
|
|
|
'MKD' => array( |
|
698
|
|
|
'admin_label' => sprintf( __( 'Macedonian denar (%1$s)', 'give' ), 'ден' ), |
|
699
|
|
|
'symbol' => 'ден', |
|
700
|
|
|
'setting' => array( |
|
701
|
|
|
'currency_position' => 'before', |
|
702
|
|
|
'thousands_separator' => ',', |
|
703
|
|
|
'decimal_separator' => '.', |
|
704
|
|
|
'number_decimals' => 2, |
|
705
|
|
|
), |
|
706
|
|
|
), |
|
707
|
|
|
'NPR' => array( |
|
708
|
|
|
'admin_label' => sprintf( __( 'Nepalese rupee (%1$s)', 'give' ), '₨' ), |
|
709
|
|
|
'symbol' => '₨', |
|
710
|
|
|
'setting' => array( |
|
711
|
|
|
'currency_position' => 'before', |
|
712
|
|
|
'thousands_separator' => ',', |
|
713
|
|
|
'decimal_separator' => '.', |
|
714
|
|
|
'number_decimals' => 2, |
|
715
|
|
|
), |
|
716
|
|
|
), |
|
717
|
|
|
'OMR' => array( |
|
718
|
|
|
'admin_label' => sprintf( __( 'Omani rial (%1$s)', 'give' ), 'ر.ع.' ), |
|
719
|
|
|
'symbol' => 'ر.ع.', |
|
720
|
|
|
'setting' => array( |
|
721
|
|
|
'currency_position' => 'before', |
|
722
|
|
|
'thousands_separator' => ',', |
|
723
|
|
|
'decimal_separator' => '.', |
|
724
|
|
|
'number_decimals' => 3, |
|
725
|
|
|
), |
|
726
|
|
|
), |
|
727
|
|
|
'PEN' => array( |
|
728
|
|
|
'admin_label' => sprintf( __( 'Peruvian nuevo sol (%1$s)', 'give' ), 'S/.' ), |
|
729
|
|
|
'symbol' => 'S/.', |
|
730
|
|
|
'setting' => array( |
|
731
|
|
|
'currency_position' => 'before', |
|
732
|
|
|
'thousands_separator' => ',', |
|
733
|
|
|
'decimal_separator' => '.', |
|
734
|
|
|
'number_decimals' => 2, |
|
735
|
|
|
), |
|
736
|
|
|
), |
|
737
|
|
|
'PKR' => array( |
|
738
|
|
|
'admin_label' => sprintf( __( 'Pakistani rupee (%1$s)', 'give' ), '₨' ), |
|
739
|
|
|
'symbol' => '₨', |
|
740
|
|
|
'setting' => array( |
|
741
|
|
|
'currency_position' => 'before', |
|
742
|
|
|
'thousands_separator' => ',', |
|
743
|
|
|
'decimal_separator' => '.', |
|
744
|
|
|
'number_decimals' => 2, |
|
745
|
|
|
), |
|
746
|
|
|
), |
|
747
|
|
|
'RON' => array( |
|
748
|
|
|
'admin_label' => sprintf( __( 'Romanian leu (%1$s)', 'give' ), 'L' ), |
|
749
|
|
|
'symbol' => 'L', |
|
750
|
|
|
'setting' => array( |
|
751
|
|
|
'currency_position' => 'after', |
|
752
|
|
|
'thousands_separator' => '.', |
|
753
|
|
|
'decimal_separator' => ',', |
|
754
|
|
|
'number_decimals' => 2, |
|
755
|
|
|
), |
|
756
|
|
|
), |
|
757
|
|
|
'SAR' => array( |
|
758
|
|
|
'admin_label' => sprintf( __( 'Saudi riyal (%1$s)', 'give' ), 'ر.س' ), |
|
759
|
|
|
'symbol' => 'ر.س', |
|
760
|
|
|
'setting' => array( |
|
761
|
|
|
'currency_position' => 'before', |
|
762
|
|
|
'thousands_separator' => ',', |
|
763
|
|
|
'decimal_separator' => '.', |
|
764
|
|
|
'number_decimals' => 2, |
|
765
|
|
|
), |
|
766
|
|
|
), |
|
767
|
|
|
'SZL' => array( |
|
768
|
|
|
'admin_label' => sprintf( __( 'Swazi lilangeni (%1$s)', 'give' ), 'L'), |
|
|
|
|
|
|
769
|
|
|
'symbol' => 'L', |
|
770
|
|
|
'setting' => array( |
|
771
|
|
|
'currency_position' => 'before', |
|
772
|
|
|
'thousands_separator' => ',', |
|
773
|
|
|
'decimal_separator' => '.', |
|
774
|
|
|
'number_decimals' => 2, |
|
775
|
|
|
), |
|
776
|
|
|
), |
|
777
|
|
|
'TOP' => array( |
|
778
|
|
|
'admin_label' => sprintf( __( 'Tongan paʻanga (%1$s)', 'give' ), 'T$'), |
|
|
|
|
|
|
779
|
|
|
'symbol' => 'T$', |
|
780
|
|
|
'setting' => array( |
|
781
|
|
|
'currency_position' => 'before', |
|
782
|
|
|
'thousands_separator' => ',', |
|
783
|
|
|
'decimal_separator' => '.', |
|
784
|
|
|
'number_decimals' => 2, |
|
785
|
|
|
), |
|
786
|
|
|
), |
|
787
|
|
|
'TZS' => array( |
|
788
|
|
|
'admin_label' => sprintf( __( 'Tanzanian shilling (%1$s)', 'give' ), 'TSh'), |
|
|
|
|
|
|
789
|
|
|
'symbol' => 'TSh', |
|
790
|
|
|
'setting' => array( |
|
791
|
|
|
'currency_position' => 'before', |
|
792
|
|
|
'thousands_separator' => ',', |
|
793
|
|
|
'decimal_separator' => '.', |
|
794
|
|
|
'number_decimals' => 2, |
|
795
|
|
|
), |
|
796
|
|
|
), |
|
797
|
|
|
'UAH' => array( |
|
798
|
|
|
'admin_label' => sprintf( __( 'Ukrainian hryvnia (%1$s)', 'give' ), '₴'), |
|
|
|
|
|
|
799
|
|
|
'symbol' => '₴', |
|
800
|
|
|
'setting' => array( |
|
801
|
|
|
'currency_position' => 'before', |
|
802
|
|
|
'thousands_separator' => ' ', |
|
803
|
|
|
'decimal_separator' => ',', |
|
804
|
|
|
'number_decimals' => 2, |
|
805
|
|
|
), |
|
806
|
|
|
), |
|
807
|
|
|
'UYU' => array( |
|
808
|
|
|
'admin_label' => sprintf( __( 'Uruguayan peso (%1$s)', 'give' ), '$U'), |
|
|
|
|
|
|
809
|
|
|
'symbol' => '$U', |
|
810
|
|
|
'setting' => array( |
|
811
|
|
|
'currency_position' => 'before', |
|
812
|
|
|
'thousands_separator' => '.', |
|
813
|
|
|
'decimal_separator' => ',', |
|
814
|
|
|
'number_decimals' => 2, |
|
815
|
|
|
), |
|
816
|
|
|
), |
|
817
|
|
|
'VEF' => array( |
|
818
|
|
|
'admin_label' => sprintf( __( 'Venezuelan bolívar (%1$s)', 'give' ), 'Bs'), |
|
|
|
|
|
|
819
|
|
|
'symbol' => 'Bs', |
|
820
|
|
|
'setting' => array( |
|
821
|
|
|
'currency_position' => 'before', |
|
822
|
|
|
'thousands_separator' => '.', |
|
823
|
|
|
'decimal_separator' => ',', |
|
824
|
|
|
'number_decimals' => 2, |
|
825
|
|
|
), |
|
826
|
|
|
), |
|
827
|
|
|
'XCD' => array( |
|
828
|
|
|
'admin_label' => sprintf( __( 'East Caribbean dollar (%1$s)', 'give' ), 'EC$'), |
|
|
|
|
|
|
829
|
|
|
'symbol' => 'EC$', |
|
830
|
|
|
'setting' => array( |
|
831
|
|
|
'currency_position' => 'before', |
|
832
|
|
|
'thousands_separator' => ',', |
|
833
|
|
|
'decimal_separator' => '.', |
|
834
|
|
|
'number_decimals' => 2, |
|
835
|
|
|
), |
|
836
|
|
|
), |
|
837
|
|
|
); |
|
838
|
|
|
|
|
839
|
|
|
/** |
|
840
|
|
|
* Filter the currencies |
|
841
|
|
|
* Note: you can register new currency by using this filter |
|
842
|
|
|
* array( |
|
843
|
|
|
* 'admin_label' => '', // required |
|
844
|
|
|
* 'symbol' => '', // required |
|
845
|
|
|
* 'setting' => '' // required |
|
846
|
|
|
* .... |
|
847
|
|
|
* ) |
|
848
|
|
|
* |
|
849
|
|
|
* @since 1.8.15 |
|
850
|
|
|
* |
|
851
|
|
|
* @param array $currencies |
|
852
|
|
|
*/ |
|
853
|
|
|
return (array) apply_filters( 'give_currencies', $currencies ); |
|
854
|
|
|
} |
|
855
|
|
|
|
|
856
|
|
|
/** |
|
857
|
|
|
* Get Currencies |
|
858
|
|
|
* |
|
859
|
|
|
* @since 1.0 |
|
860
|
|
|
* |
|
861
|
|
|
* @param string $info Specify currency info |
|
862
|
|
|
* |
|
863
|
|
|
* @return array $currencies A list of the available currencies |
|
864
|
|
|
*/ |
|
865
|
|
|
function give_get_currencies( $info = 'admin_label' ) { |
|
866
|
|
|
|
|
867
|
|
|
$currencies = give_get_currencies_list(); |
|
868
|
|
|
|
|
869
|
|
|
// Backward compatibility: handle old way of currency registration. |
|
870
|
|
|
// Backward compatibility: Return desired result. |
|
871
|
|
|
if ( ! empty( $currencies ) ) { |
|
872
|
|
|
foreach ( $currencies as $currency_code => $currency_setting ) { |
|
873
|
|
|
if ( is_string( $currency_setting ) ) { |
|
874
|
|
|
$currencies[ $currency_code ] = array( |
|
875
|
|
|
'admin_label' => $currency_setting, |
|
876
|
|
|
); |
|
877
|
|
|
} |
|
878
|
|
|
|
|
879
|
|
|
$currencies[ $currency_code ] = wp_parse_args( |
|
880
|
|
|
$currencies[ $currency_code ], |
|
881
|
|
|
array( |
|
882
|
|
|
'admin_label' => '', |
|
883
|
|
|
'symbol' => $currency_code, |
|
884
|
|
|
'setting' => array(), |
|
885
|
|
|
) |
|
886
|
|
|
); |
|
887
|
|
|
} |
|
888
|
|
|
|
|
889
|
|
|
if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) { |
|
890
|
|
|
$currencies = wp_list_pluck( $currencies, $info ); |
|
891
|
|
|
} |
|
892
|
|
|
} |
|
893
|
|
|
|
|
894
|
|
|
return $currencies; |
|
895
|
|
|
} |
|
896
|
|
|
|
|
897
|
|
|
|
|
898
|
|
|
/** |
|
899
|
|
|
* Get all currency symbols |
|
900
|
|
|
* |
|
901
|
|
|
* @since 1.8.14 |
|
902
|
|
|
* |
|
903
|
|
|
* @param bool $decode_currencies |
|
904
|
|
|
* |
|
905
|
|
|
* @return array |
|
906
|
|
|
*/ |
|
907
|
|
|
function give_currency_symbols( $decode_currencies = false ) { |
|
908
|
|
|
$currencies = give_get_currencies( 'symbol' ); |
|
909
|
|
|
|
|
910
|
|
|
if ( $decode_currencies ) { |
|
911
|
|
|
array_walk( $currencies, function ( &$currency_symbol ) { |
|
912
|
|
|
$currency_symbol = html_entity_decode( $currency_symbol, ENT_COMPAT, 'UTF-8' ); |
|
913
|
|
|
} ); |
|
914
|
|
|
} |
|
915
|
|
|
|
|
916
|
|
|
/** |
|
917
|
|
|
* Filter the currency symbols |
|
918
|
|
|
* |
|
919
|
|
|
* @since 1.8.14 |
|
920
|
|
|
* |
|
921
|
|
|
* @param array $currencies |
|
922
|
|
|
*/ |
|
923
|
|
|
return apply_filters( 'give_currency_symbols', $currencies ); |
|
924
|
|
|
} |
|
925
|
|
|
|
|
926
|
|
|
|
|
927
|
|
|
/** |
|
928
|
|
|
* Give Currency Symbol |
|
929
|
|
|
* |
|
930
|
|
|
* Given a currency determine the symbol to use. If no currency given, site default is used. If no symbol is determine, |
|
931
|
|
|
* the currency string is returned. |
|
932
|
|
|
* |
|
933
|
|
|
* @since 1.0 |
|
934
|
|
|
* |
|
935
|
|
|
* @param string $currency The currency string. |
|
936
|
|
|
* @param bool $decode_currency Option to HTML decode the currency symbol. |
|
937
|
|
|
* |
|
938
|
|
|
* @return string The symbol to use for the currency |
|
939
|
|
|
*/ |
|
940
|
|
View Code Duplication |
function give_currency_symbol( $currency = '', $decode_currency = false ) { |
|
|
|
|
|
|
941
|
|
|
|
|
942
|
|
|
if ( empty( $currency ) ) { |
|
943
|
|
|
$currency = give_get_currency(); |
|
944
|
|
|
} |
|
945
|
|
|
|
|
946
|
|
|
$currencies = give_currency_symbols( $decode_currency ); |
|
947
|
|
|
$symbol = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency; |
|
948
|
|
|
|
|
949
|
|
|
/** |
|
950
|
|
|
* Filter the currency symbol |
|
951
|
|
|
* |
|
952
|
|
|
* @since 1.0 |
|
953
|
|
|
* |
|
954
|
|
|
* @param string $symbol |
|
955
|
|
|
* @param string $currency |
|
956
|
|
|
*/ |
|
957
|
|
|
return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
958
|
|
|
} |
|
959
|
|
|
|
|
960
|
|
|
|
|
961
|
|
|
/** |
|
962
|
|
|
* Get currency name. |
|
963
|
|
|
* |
|
964
|
|
|
* @since 1.8.8 |
|
965
|
|
|
* |
|
966
|
|
|
* @param string $currency_code |
|
967
|
|
|
* |
|
968
|
|
|
* @return string |
|
969
|
|
|
*/ |
|
970
|
|
|
function give_get_currency_name( $currency_code ) { |
|
971
|
|
|
$currency_name = ''; |
|
972
|
|
|
$currency_names = give_get_currencies(); |
|
973
|
|
|
|
|
974
|
|
|
if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { |
|
975
|
|
|
$currency_name = explode( '(', $currency_names[ $currency_code ] ); |
|
976
|
|
|
$currency_name = trim( current( $currency_name ) ); |
|
977
|
|
|
} |
|
978
|
|
|
|
|
979
|
|
|
/** |
|
980
|
|
|
* Filter the currency name |
|
981
|
|
|
* |
|
982
|
|
|
* @since 1.8.8 |
|
983
|
|
|
* |
|
984
|
|
|
* @param string $currency_name |
|
985
|
|
|
* @param string $currency_code |
|
986
|
|
|
*/ |
|
987
|
|
|
return apply_filters( 'give_currency_name', $currency_name, $currency_code ); |
|
988
|
|
|
} |
|
989
|
|
|
|
|
990
|
|
|
/** |
|
991
|
|
|
* Formats the currency displayed. |
|
992
|
|
|
* |
|
993
|
|
|
* @since 1.0 |
|
994
|
|
|
* |
|
995
|
|
|
* @param string $price The donation amount. |
|
996
|
|
|
* @param array $args It accepts 'currency_code', 'decode_currency' and 'form_id'. |
|
997
|
|
|
* |
|
998
|
|
|
* @return mixed|string |
|
999
|
|
|
*/ |
|
1000
|
|
|
function give_currency_filter( $price = '', $args = array() ) { |
|
1001
|
|
|
|
|
1002
|
|
|
// Get functions arguments. |
|
1003
|
|
|
$func_args = func_get_args(); |
|
1004
|
|
|
|
|
1005
|
|
|
// Backward compatibility: modify second param to array |
|
1006
|
|
|
if ( isset( $func_args[1] ) && is_string( $func_args[1] ) ) { |
|
1007
|
|
|
$args = array( |
|
1008
|
|
|
'currency_code' => isset( $func_args[1] ) ? $func_args[1] : '', |
|
1009
|
|
|
'decode_currency' => isset( $func_args[2] ) ? $func_args[2] : false, |
|
1010
|
|
|
'form_id' => isset( $func_args[3] ) ? $func_args[3] : '', |
|
1011
|
|
|
); |
|
1012
|
|
|
|
|
1013
|
|
|
give_doing_it_wrong( __FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION ); |
|
1014
|
|
|
} |
|
1015
|
|
|
|
|
1016
|
|
|
// Set default values. |
|
1017
|
|
|
$args = wp_parse_args( |
|
1018
|
|
|
$args, |
|
1019
|
|
|
array( |
|
1020
|
|
|
'currency_code' => '', |
|
1021
|
|
|
'decode_currency' => false, |
|
1022
|
|
|
'form_id' => '', |
|
1023
|
|
|
) |
|
1024
|
|
|
); |
|
1025
|
|
|
|
|
1026
|
|
|
if ( empty( $args['currency_code'] ) || ! array_key_exists( (string) $args['currency_code'], give_get_currencies() ) ) { |
|
1027
|
|
|
$args['currency_code'] = give_get_currency( $args['form_id'] ); |
|
1028
|
|
|
} |
|
1029
|
|
|
|
|
1030
|
|
|
$args['position'] = give_get_option( 'currency_position', 'before' ); |
|
1031
|
|
|
|
|
1032
|
|
|
$negative = $price < 0; |
|
1033
|
|
|
|
|
1034
|
|
|
if ( $negative ) { |
|
1035
|
|
|
// Remove proceeding "-". |
|
1036
|
|
|
$price = substr( $price, 1 ); |
|
1037
|
|
|
} |
|
1038
|
|
|
|
|
1039
|
|
|
$args['symbol'] = give_currency_symbol( $args['currency_code'], $args['decode_currency'] ); |
|
1040
|
|
|
|
|
1041
|
|
|
switch ( $args['currency_code'] ) : |
|
1042
|
|
|
case 'GBP' : |
|
1043
|
|
|
case 'BRL' : |
|
1044
|
|
|
case 'EUR' : |
|
1045
|
|
|
case 'USD' : |
|
1046
|
|
|
case 'AUD' : |
|
1047
|
|
|
case 'CAD' : |
|
1048
|
|
|
case 'HKD' : |
|
1049
|
|
|
case 'MXN' : |
|
1050
|
|
|
case 'NZD' : |
|
1051
|
|
|
case 'SGD' : |
|
1052
|
|
|
case 'JPY' : |
|
1053
|
|
|
case 'THB' : |
|
1054
|
|
|
case 'INR' : |
|
1055
|
|
|
case 'IDR' : |
|
1056
|
|
|
case 'IRR' : |
|
1057
|
|
|
case 'TRY' : |
|
1058
|
|
|
case 'RUB' : |
|
1059
|
|
|
case 'SEK' : |
|
1060
|
|
|
case 'PLN' : |
|
1061
|
|
|
case 'PHP' : |
|
1062
|
|
|
case 'TWD' : |
|
1063
|
|
|
case 'MYR' : |
|
1064
|
|
|
case 'CZK' : |
|
1065
|
|
|
case 'DKK' : |
|
1066
|
|
|
case 'HUF' : |
|
1067
|
|
|
case 'ILS' : |
|
1068
|
|
|
case 'MAD' : |
|
1069
|
|
|
case 'KRW' : |
|
1070
|
|
View Code Duplication |
case 'ZAR' : |
|
|
|
|
|
|
1071
|
|
|
$formatted = ( 'before' === $args['position'] ? $args['symbol'] . $price : $price . $args['symbol'] ); |
|
1072
|
|
|
break; |
|
1073
|
|
View Code Duplication |
case 'NOK': |
|
|
|
|
|
|
1074
|
|
|
$formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1075
|
|
|
break; |
|
1076
|
|
View Code Duplication |
default: |
|
|
|
|
|
|
1077
|
|
|
$formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1078
|
|
|
break; |
|
1079
|
|
|
endswitch; |
|
1080
|
|
|
|
|
1081
|
|
|
/** |
|
1082
|
|
|
* Filter formatted amount |
|
1083
|
|
|
* |
|
1084
|
|
|
* @since 1.8.17 |
|
1085
|
|
|
*/ |
|
1086
|
|
|
$formatted = apply_filters( 'give_currency_filter', $formatted, $args, $price ); |
|
1087
|
|
|
|
|
1088
|
|
|
/** |
|
1089
|
|
|
* Filter formatted amount with currency |
|
1090
|
|
|
* |
|
1091
|
|
|
* Filter name depends upon current value of currency and currency position. |
|
1092
|
|
|
* For example : |
|
1093
|
|
|
* if currency is USD and currency position is before then |
|
1094
|
|
|
* filter name will be give_usd_currency_filter_before |
|
1095
|
|
|
* |
|
1096
|
|
|
* and if currency is USD and currency position is after then |
|
1097
|
|
|
* filter name will be give_usd_currency_filter_after |
|
1098
|
|
|
*/ |
|
1099
|
|
|
$formatted = apply_filters( |
|
1100
|
|
|
'give_' . strtolower( $args['currency_code'] ) . "_currency_filter_{$args['position']}", |
|
1101
|
|
|
$formatted, |
|
1102
|
|
|
$args['currency_code'], |
|
1103
|
|
|
$price, |
|
1104
|
|
|
$args |
|
1105
|
|
|
); |
|
1106
|
|
|
|
|
1107
|
|
|
if ( $negative ) { |
|
1108
|
|
|
// Prepend the minus sign before the currency sign. |
|
1109
|
|
|
$formatted = '-' . $formatted; |
|
1110
|
|
|
} |
|
1111
|
|
|
|
|
1112
|
|
|
return $formatted; |
|
1113
|
|
|
} |
|
1114
|
|
|
|
|
1115
|
|
|
|
|
1116
|
|
|
/** |
|
1117
|
|
|
* Zero Decimal based Currency. |
|
1118
|
|
|
* |
|
1119
|
|
|
* @since 1.8.14 |
|
1120
|
|
|
* @see https://github.com/WordImpress/Give/issues/2191 |
|
1121
|
|
|
* |
|
1122
|
|
|
* @param string $currency Currency code |
|
1123
|
|
|
* |
|
1124
|
|
|
* @return bool |
|
1125
|
|
|
*/ |
|
1126
|
|
|
function give_is_zero_based_currency( $currency = '' ) { |
|
1127
|
|
|
$zero_based_currency = array( |
|
1128
|
|
|
'PYG', // Paraguayan Guarani. |
|
1129
|
|
|
'GNF', // Guinean Franc. |
|
1130
|
|
|
'RWF', // Rwandan Franc. |
|
1131
|
|
|
'JPY', // Japanese Yen. |
|
1132
|
|
|
'BIF', // Burundian Franc. |
|
1133
|
|
|
'KRW', // South Korean Won. |
|
1134
|
|
|
'MGA', // Malagasy Ariary. |
|
1135
|
|
|
'XAF', // Central African Cfa Franc. |
|
1136
|
|
|
'XPF', // Cfp Franc. |
|
1137
|
|
|
'CLP', // Chilean Peso. |
|
1138
|
|
|
'KMF', // Comorian Franc. |
|
1139
|
|
|
'DJF', // Djiboutian Franc. |
|
1140
|
|
|
'VUV', // Vanuatu Vatu. |
|
1141
|
|
|
'VND', // Vietnamese Dong. |
|
1142
|
|
|
'XOF', // West African Cfa Franc. |
|
1143
|
|
|
); |
|
1144
|
|
|
|
|
1145
|
|
|
// Set default currency. |
|
1146
|
|
|
if ( empty( $currency ) ) { |
|
1147
|
|
|
$currency = give_get_currency(); |
|
1148
|
|
|
} |
|
1149
|
|
|
|
|
1150
|
|
|
// Check for Zero Based Currency. |
|
1151
|
|
|
if ( in_array( $currency, $zero_based_currency ) ) { |
|
1152
|
|
|
return true; |
|
1153
|
|
|
} |
|
1154
|
|
|
|
|
1155
|
|
|
return false; |
|
1156
|
|
|
} |
|
1157
|
|
|
|
|
1158
|
|
|
|
|
1159
|
|
|
/** |
|
1160
|
|
|
* Check if currency support right to left direction or not. |
|
1161
|
|
|
* |
|
1162
|
|
|
* @param string $currency |
|
1163
|
|
|
* |
|
1164
|
|
|
* @return bool |
|
1165
|
|
|
*/ |
|
1166
|
|
|
function give_is_right_to_left_supported_currency( $currency = '' ) { |
|
1167
|
|
|
$zero_based_currency = apply_filters( |
|
1168
|
|
|
'give_right_to_left_supported_currency', |
|
1169
|
|
|
array( |
|
1170
|
|
|
'IRR', |
|
1171
|
|
|
'RIAL', |
|
1172
|
|
|
'MAD', |
|
1173
|
|
|
'AED', |
|
1174
|
|
|
'BHD', |
|
1175
|
|
|
'KWD', |
|
1176
|
|
|
'OMR', |
|
1177
|
|
|
'SAR', |
|
1178
|
|
|
) |
|
1179
|
|
|
); |
|
1180
|
|
|
|
|
1181
|
|
|
// Set default currency. |
|
1182
|
|
|
if ( empty( $currency ) ) { |
|
1183
|
|
|
$currency = give_get_currency(); |
|
1184
|
|
|
} |
|
1185
|
|
|
|
|
1186
|
|
|
// Check for Zero Based Currency. |
|
1187
|
|
|
if ( in_array( $currency, $zero_based_currency ) ) { |
|
1188
|
|
|
return true; |
|
1189
|
|
|
} |
|
1190
|
|
|
|
|
1191
|
|
|
return false; |
|
1192
|
|
|
} |