From 38893a2a1d5f93d74094231b292e797b384c8318 Mon Sep 17 00:00:00 2001 From: "daan.rijpkema" Date: Mon, 4 Dec 2023 18:57:49 +0100 Subject: [PATCH 1/2] Better check on GravityForm plugin activation --- bluem.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bluem.php b/bluem.php index 52ab104..ef8cf50 100644 --- a/bluem.php +++ b/bluem.php @@ -98,13 +98,12 @@ function is_contactform7_activated() { * Check if Gravity Forms is activated */ if ( ! function_exists( 'is_gravityforms_activated' ) ) { - function is_gravityforms_activated() { + function is_gravityforms_activated(): bool + { $active_plugins = get_option( 'active_plugins' ); - if ( in_array('gravityforms', $active_plugins) ) { - return true; - } - return false; + return in_array('gravityforms', $active_plugins, true) + || in_array('gravityforms/gravityforms.php', $active_plugins, true); } } From ec827fcc3f7bc17ec74fbc2d18eed7c509e0f33e Mon Sep 17 00:00:00 2001 From: "daan.rijpkema" Date: Mon, 4 Dec 2023 19:17:40 +0100 Subject: [PATCH 2/2] Prevent error in checkout on non-yet instantiated bluem object --- gateways/Bluem_Mandates_Payment_Gateway.php | 6 +++++- gateways/Bluem_iDEAL_Payment_Gateway.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gateways/Bluem_Mandates_Payment_Gateway.php b/gateways/Bluem_Mandates_Payment_Gateway.php index 82ef8b3..b3cfcd7 100644 --- a/gateways/Bluem_Mandates_Payment_Gateway.php +++ b/gateways/Bluem_Mandates_Payment_Gateway.php @@ -266,6 +266,10 @@ private function _checkExistingMandate( $order ) { */ public function payment_fields() { + if($this->bluem === null) { + return; + } + $BICs = $this->bluem->retrieveBICsForContext( "Mandates" ); $description = $this->get_description(); @@ -307,7 +311,7 @@ public function validate_fields() * * @param String $order_id * - * @return void + * @return array */ public function process_payment( $order_id ) { diff --git a/gateways/Bluem_iDEAL_Payment_Gateway.php b/gateways/Bluem_iDEAL_Payment_Gateway.php index 95c1b6e..0415040 100644 --- a/gateways/Bluem_iDEAL_Payment_Gateway.php +++ b/gateways/Bluem_iDEAL_Payment_Gateway.php @@ -34,12 +34,16 @@ public function __construct() */ public function payment_fields() { + if($this->bluem === null) { + return; + } + $BICs = $this->bluem->retrieveBICsForContext( "Payments" ); $description = $this->get_description(); $options = []; - + if ( $description ) { echo wpautop( wptexturize( $description ) ); // @codingStandardsIgnoreLine. }