-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from magently/master
New version: 0.7.4
- Loading branch information
Showing
12 changed files
with
478 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
269 changes: 269 additions & 0 deletions
269
app/code/community/Sign2pay/Payment/Helper/CountryCodes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,269 @@ | ||
<?php | ||
|
||
class Sign2pay_Payment_Helper_CountryCodes extends Mage_Core_Helper_Abstract | ||
{ | ||
/** | ||
* Get calling code for specified country | ||
* | ||
* @param string containing two-digit country code | ||
* | ||
* @return calling code number or null | ||
*/ | ||
public function getCountryCallingCode($country) | ||
{ | ||
$country_codes = array( | ||
'AF' => '93', | ||
'AX' => '35818', | ||
'NL' => '31', | ||
'AN' => '599', | ||
'AL' => '355', | ||
'DZ' => '213', | ||
'AS' => '685', | ||
'AD' => '376', | ||
'AO' => '244', | ||
'AI' => '1264', | ||
'AQ' => '672', | ||
'AG' => '1268', | ||
'AE' => '971', | ||
'AR' => '54', | ||
'AM' => '374', | ||
'AW' => '297', | ||
'AU' => '61', | ||
'AZ' => '994', | ||
'BS' => '1242', | ||
'BH' => '973', | ||
'BD' => '880', | ||
'BB' => '1242', | ||
'BE' => '32', | ||
'BZ' => '501', | ||
'BJ' => '229', | ||
'BM' => '1441', | ||
'BT' => '975', | ||
'BO' => '591', | ||
'BA' => '387', | ||
'BW' => '267', | ||
'BV' => '47', | ||
'BR' => '55', | ||
'GB' => '44', | ||
'IO' => '246', | ||
'VG' => '1284', | ||
'BN' => '673', | ||
'BG' => '359', | ||
'BF' => '226', | ||
'BI' => '257', | ||
'KY' => '1345', | ||
'CL' => '56', | ||
'CK' => '682', | ||
'CR' => '506', | ||
'DJ' => '253', | ||
'DM' => '1767', | ||
'DO' => '1809', | ||
'EC' => '593', | ||
'EG' => '20', | ||
'SV' => '503', | ||
'ER' => '291', | ||
'ES' => '34', | ||
'ZA' => '27', | ||
'GS' => '500', | ||
'KR' => '82', | ||
'ET' => '251', | ||
'FK' => '500', | ||
'FJ' => '679', | ||
'PH' => '63', | ||
'FO' => '298', | ||
'GA' => '241', | ||
'GM' => '220', | ||
'GE' => '995', | ||
'GH' => '233', | ||
'GI' => '350', | ||
'GD' => '1473', | ||
'GL' => '299', | ||
'GP' => '590', | ||
'GU' => '1671', | ||
'GT' => '502', | ||
'GG' => '44', | ||
'GN' => '224', | ||
'GW' => '245', | ||
'GY' => '592', | ||
'HT' => '509', | ||
'HM' => '61', | ||
'HN' => '504', | ||
'HK' => '852', | ||
'SJ' => '47', | ||
'ID' => '62', | ||
'IN' => '91', | ||
'IQ' => '964', | ||
'IR' => '98', | ||
'IE' => '353', | ||
'IS' => '354', | ||
'IL' => '972', | ||
'IT' => '39', | ||
'TL' => '670', | ||
'AT' => '43', | ||
'JM' => '1876', | ||
'JP' => '81', | ||
'YE' => '967', | ||
'JE' => '44', | ||
'JO' => '962', | ||
'CX' => '61', | ||
'KH' => '855', | ||
'CM' => '237', | ||
'CA' => '1', | ||
'CV' => '238', | ||
'KZ' => '7', | ||
'KE' => '254', | ||
'CF' => '236', | ||
'CN' => '86', | ||
'KG' => '996', | ||
'KI' => '686', | ||
'CO' => '57', | ||
'KM' => '269', | ||
'CG' => '242', | ||
'CD' => '243', | ||
'CC' => '61', | ||
'GR' => '30', | ||
'HR' => '385', | ||
'CU' => '53', | ||
'KW' => '965', | ||
'CY' => '357', | ||
'LA' => '856', | ||
'LV' => '371', | ||
'LS' => '266', | ||
'LB' => '961', | ||
'LR' => '231', | ||
'LY' => '218', | ||
'LI' => '423', | ||
'LT' => '370', | ||
'LU' => '352', | ||
'EH' => '21228', | ||
'MO' => '853', | ||
'MG' => '261', | ||
'MK' => '389', | ||
'MW' => '265', | ||
'MV' => '960', | ||
'MY' => '60', | ||
'ML' => '223', | ||
'MT' => '356', | ||
'IM' => '44', | ||
'MA' => '212', | ||
'MH' => '692', | ||
'MQ' => '596', | ||
'MR' => '222', | ||
'MU' => '230', | ||
'YT' => '262', | ||
'MX' => '52', | ||
'FM' => '691', | ||
'MD' => '373', | ||
'MC' => '377', | ||
'MN' => '976', | ||
'ME' => '382', | ||
'MS' => '1664', | ||
'MZ' => '258', | ||
'MM' => '95', | ||
'NA' => '264', | ||
'NR' => '674', | ||
'NP' => '977', | ||
'NI' => '505', | ||
'NE' => '227', | ||
'NG' => '234', | ||
'NU' => '683', | ||
'NF' => '672', | ||
'NO' => '47', | ||
'CI' => '255', | ||
'OM' => '968', | ||
'PK' => '92', | ||
'PW' => '680', | ||
'PS' => '970', | ||
'PA' => '507', | ||
'PG' => '675', | ||
'PY' => '595', | ||
'PE' => '51', | ||
'PN' => '870', | ||
'KP' => '850', | ||
'MP' => '1670', | ||
'PT' => '351', | ||
'PR' => '1', | ||
'PL' => '48', | ||
'GQ' => '240', | ||
'QA' => '974', | ||
'FR' => '33', | ||
'GF' => '594', | ||
'PF' => '689', | ||
'TF' => '33', | ||
'RO' => '40', | ||
'RW' => '250', | ||
'SE' => '46', | ||
'RE' => '262', | ||
'SH' => '290', | ||
'KN' => '1869', | ||
'LC' => '1758', | ||
'VC' => '1784', | ||
'BL' => '590', | ||
'MF' => '1599', | ||
'PM' => '508', | ||
'DE' => '49', | ||
'SB' => '677', | ||
'ZM' => '260', | ||
'WS' => '685', | ||
'SM' => '378', | ||
'SA' => '966', | ||
'SN' => '221', | ||
'RS' => '381', | ||
'SC' => '248', | ||
'SL' => '232', | ||
'SG' => '65', | ||
'SK' => '421', | ||
'SI' => '386', | ||
'SO' => '252', | ||
'LK' => '94', | ||
'SD' => '249', | ||
'FI' => '358', | ||
'SR' => '594', | ||
'CH' => '41', | ||
'SZ' => '268', | ||
'SY' => '963', | ||
'ST' => '239', | ||
'TJ' => '992', | ||
'TW' => '886', | ||
'TZ' => '255', | ||
'DK' => '45', | ||
'TH' => '66', | ||
'TG' => '228', | ||
'TK' => '690', | ||
'TO' => '676', | ||
'TT' => '1868', | ||
'TN' => '216', | ||
'TR' => '90', | ||
'TM' => '993', | ||
'TC' => '1649', | ||
'TV' => '688', | ||
'TD' => '235', | ||
'CZ' => '420', | ||
'UG' => '256', | ||
'UA' => '380', | ||
'HU' => '36', | ||
'UY' => '598', | ||
'NC' => '687', | ||
'NZ' => '64', | ||
'UZ' => '998', | ||
'BY' => '375', | ||
'VU' => '678', | ||
'VA' => '39', | ||
'VE' => '58', | ||
'RU' => '7', | ||
'VN' => '84', | ||
'EE' => '372', | ||
'WF' => '681', | ||
'US' => '1', | ||
'VI' => '1340', | ||
'UM' => '1', | ||
'ZW' => '263' | ||
); | ||
|
||
$country = strtoupper($country); | ||
if (array_key_exists($country, $country_codes)) { | ||
return $country_codes[$country]; | ||
} | ||
return null; | ||
} | ||
} |
Oops, something went wrong.