nutzung von multibite (mb_) funktionen entfernt, da mittlerweile unnötig.
This commit is contained in:
parent
0c3de7f6f3
commit
0c7df724de
|
@ -135,20 +135,20 @@ class Validate
|
||||||
"ES" => 24, "SE" => 24, "CH" => 21, "TN" => 24, "TR" => 26, "AE" => 23, "GB" => 22, "VG" => 24
|
"ES" => 24, "SE" => 24, "CH" => 21, "TN" => 24, "TR" => 26, "AE" => 23, "GB" => 22, "VG" => 24
|
||||||
];
|
];
|
||||||
|
|
||||||
$iban = mb_ereg_replace("/(\s|\-)/", "", $iban); // sanitize for validation (remove spaces)
|
$iban = preg_replace("/(\s|\-)/", "", $iban); // sanitize for validation (remove spaces)
|
||||||
$country = mb_strtoupper(mb_substr($iban, 0, 2));
|
$country = strtoupper(substr($iban, 0, 2));
|
||||||
|
|
||||||
// we know the country the IBAN belongs to?
|
// we know the country the IBAN belongs to?
|
||||||
if(isset($country_length[$country])) {
|
if(isset($country_length[$country])) {
|
||||||
|
|
||||||
// The IBAN matches in length and basic structure?
|
// The IBAN matches in length and basic structure?
|
||||||
$matches = null;
|
$matches = null;
|
||||||
if(mb_ereg_match('/^([A-Za-z]{2})(\d{2})([A-Za-z0-9]{' . ($country_length[$country]-4) . '})$/', $iban, $matches)) {
|
if(preg_match('/^([A-Za-z]{2})(\d{2})([A-Za-z0-9]{' . ($country_length[$country]-4) . '})$/', $iban, $matches)) {
|
||||||
$checkNum = $matches[1];
|
$checkNum = $matches[1];
|
||||||
$bban = strtoupper($matches[2]);
|
$bban = strtoupper($matches[2]);
|
||||||
|
|
||||||
// Replace letters with digits (a or A => 11, b or B => 12,..)
|
// Replace letters with digits (a or A => 11, b or B => 12,..)
|
||||||
$checkString = mb_ereg_replace_callback('/[A-Z]/', function ($matches) {
|
$checkString = preg_replace_callback('/[A-Z]/', function ($matches) {
|
||||||
return base_convert($matches[0], 36, 10);
|
return base_convert($matches[0], 36, 10);
|
||||||
}, $bban . $country . '00');
|
}, $bban . $country . '00');
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class Validate
|
||||||
$swift = trim($swift); // sanitize swift/bic
|
$swift = trim($swift); // sanitize swift/bic
|
||||||
|
|
||||||
if($iban !== null) {
|
if($iban !== null) {
|
||||||
$iban = mb_ereg_replace("/(\s|\-)/", "", $iban); // sanitize iban
|
$iban = preg_replace("/(\s|\-)/", "", $iban); // sanitize iban
|
||||||
|
|
||||||
$api_result = file_get_contents("https://api.swiftrefdata.com/v1/ibans/$iban/bic.xml");
|
$api_result = file_get_contents("https://api.swiftrefdata.com/v1/ibans/$iban/bic.xml");
|
||||||
$api_result_array = json_decode(json_encode((array) simplexml_load_string($api_result)),1);
|
$api_result_array = json_decode(json_encode((array) simplexml_load_string($api_result)),1);
|
||||||
|
@ -199,7 +199,7 @@ class Validate
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mb_ereg_match("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift);
|
return preg_match("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue