added base64 for safe-url format and added pwa for phone
This commit is contained in:
@@ -279,9 +279,29 @@ class BillplzService
|
||||
}
|
||||
|
||||
protected function isBase64($string) {
|
||||
if($this->isBase64UrlSafe($string)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (preg_match('/^[A-Za-z0-9+\/=]+$/', $string)) {
|
||||
return base64_encode(base64_decode($string, true)) === $string;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function isBase64UrlSafe($string) {
|
||||
// Convert URL-safe Base64 to standard Base64
|
||||
$standardBase64 = str_replace(['-', '_'], ['+', '/'], $string);
|
||||
|
||||
// Add padding if necessary
|
||||
$remainder = strlen($standardBase64) % 4;
|
||||
if ($remainder > 0) {
|
||||
$standardBase64 .= str_repeat('=', 4 - $remainder);
|
||||
}
|
||||
|
||||
// Attempt to decode the string
|
||||
$decoded = base64_decode($standardBase64, true);
|
||||
|
||||
return $decoded !== false; // Return true if it successfully decodes
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user