mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix browser detection on ApplePay module.
This commit is contained in:
parent
ac7779bc41
commit
b352b702c9
2 changed files with 7 additions and 1 deletions
|
@ -93,6 +93,11 @@ return array(
|
|||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
$user_agent = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ?? '' );
|
||||
if ( $user_agent ) {
|
||||
foreach ( PropertiesDictionary::DISALLOWED_USER_AGENTS as $disallowed_agent ) {
|
||||
if ( strpos( $user_agent, $disallowed_agent ) !== false ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
foreach ( PropertiesDictionary::ALLOWED_USER_AGENTS as $allowed_agent ) {
|
||||
if ( strpos( $user_agent, $allowed_agent ) !== false ) {
|
||||
return true;
|
||||
|
|
|
@ -13,7 +13,8 @@ namespace WooCommerce\PayPalCommerce\Applepay\Assets;
|
|||
* Class PropertiesDictionary
|
||||
*/
|
||||
class PropertiesDictionary {
|
||||
public const ALLOWED_USER_AGENTS = array( 'Safari', 'Macintosh', 'iPhone', 'iPad', 'iPod' );
|
||||
public const DISALLOWED_USER_AGENTS = array( 'Chrome' );
|
||||
public const ALLOWED_USER_AGENTS = array( 'Safari', 'Macintosh', 'iPhone', 'iPad', 'iPod' );
|
||||
|
||||
public const BILLING_CONTACT_INVALID = 'billing Contact Invalid';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue