WooCommerce PayPal Express Checkout Payment Gateway - Version 1.1.1

Version Description

  • Fixed fatal error prior to PHP 5.5 caused by passing empty() a non-variables.
Download this release

Release Info

Developer akeda
Plugin Icon 128x128 WooCommerce PayPal Express Checkout Payment Gateway
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.1

includes/abstracts/abstract-wc-gateway-ppec.php CHANGED
@@ -228,14 +228,17 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
228
  $settings = wc_gateway_ppec()->settings->load_settings( true );
229
  $creds = $settings->get_active_api_credentials();
230
 
231
- if ( ! empty( $creds->get_username() ) ) {
 
232
 
233
- if ( empty( $creds->get_password() ) ) {
 
 
234
  WC_Admin_Settings::add_error( sprintf( __( 'Error: You must enter a %s API password.' ), __( $settings->get_environment(), 'woocommerce-gateway-paypal-express-checkout' ) ) );
235
  return false;
236
  }
237
 
238
- if ( is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Signature' ) && ! empty( $creds->get_signature() ) ) {
239
 
240
  try {
241
 
@@ -250,7 +253,7 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
250
  WC_Admin_Settings::add_error( sprintf( __( 'An error occurred while trying to validate your %s API credentials. Unable to verify that your API credentials are correct.', 'woocommerce-gateway-paypal-express-checkout' ), __( $settings->get_environment(), 'woocommerce-gateway-paypal-express-checkout' ) ) );
251
  }
252
 
253
- } elseif ( is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Certificate' ) && ! empty( $creds->get_certificate() ) ) {
254
 
255
  $cert = @openssl_x509_read( $creds->get_certificate() );
256
 
228
  $settings = wc_gateway_ppec()->settings->load_settings( true );
229
  $creds = $settings->get_active_api_credentials();
230
 
231
+ $username = $creds->get_username();
232
+ $password = $creds->get_password();
233
 
234
+ if ( ! empty( $username ) ) {
235
+
236
+ if ( empty( $password ) ) {
237
  WC_Admin_Settings::add_error( sprintf( __( 'Error: You must enter a %s API password.' ), __( $settings->get_environment(), 'woocommerce-gateway-paypal-express-checkout' ) ) );
238
  return false;
239
  }
240
 
241
+ if ( is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Signature' ) && $creds->get_signature() ) {
242
 
243
  try {
244
 
253
  WC_Admin_Settings::add_error( sprintf( __( 'An error occurred while trying to validate your %s API credentials. Unable to verify that your API credentials are correct.', 'woocommerce-gateway-paypal-express-checkout' ), __( $settings->get_environment(), 'woocommerce-gateway-paypal-express-checkout' ) ) );
254
  }
255
 
256
+ } elseif ( is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Certificate' ) && $creds->get_certificate() ) {
257
 
258
  $cert = @openssl_x509_read( $creds->get_certificate() );
259
 
includes/settings/settings-ppec.php CHANGED
@@ -4,8 +4,11 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
 
7
- $needs_creds = empty( $this->get_option( 'api_username' ) );
8
- $needs_sandbox_creds = empty( $this->get_option( 'sandbox_api_username' ) );
 
 
 
9
  $enable_ips = wc_gateway_ppec()->ips->is_supported();
10
 
11
  if ( $enable_ips && $needs_creds ) {
4
  exit;
5
  }
6
 
7
+ $api_username = $this->get_option( 'api_username' );
8
+ $sandbox_api_username = $this->get_option( 'sandbox_api_username' );
9
+
10
+ $needs_creds = empty( $api_username );
11
+ $needs_sandbox_creds = empty( $sandbox_api_username );
12
  $enable_ips = wc_gateway_ppec()->ips->is_supported();
13
 
14
  if ( $enable_ips && $needs_creds ) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy,
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
4
  Requires at least: 4.4
5
  Tested up to: 4.4
6
- Stable tag: 1.1.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -85,6 +85,9 @@ https://gist.github.com/mikejolley/ad2ecc286c9ad6cefbb7065ba6dfef48
85
 
86
  == Changelog ==
87
 
 
 
 
88
  = 1.1.0 =
89
  * Improved flow after express checkout by removing billing and shipping fields and simply allowing shipping method selection.
90
  * Fix - Fixed in-context checkout to work after ajax cart reload.
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
4
  Requires at least: 4.4
5
  Tested up to: 4.4
6
+ Stable tag: 1.1.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
85
 
86
  == Changelog ==
87
 
88
+ = 1.1.1 =
89
+ * Fixed fatal error prior to PHP 5.5 caused by passing empty() a non-variables.
90
+
91
  = 1.1.0 =
92
  * Improved flow after express checkout by removing billing and shipping fields and simply allowing shipping method selection.
93
  * Fix - Fixed in-context checkout to work after ajax cart reload.
woocommerce-gateway-paypal-express-checkout.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce PayPal Express Checkout Gateway
4
  * Plugin URI: https://www.woothemes.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: A payment gateway for PayPal Express Checkout (https://www.paypal.com/us/webapps/mpp/express-checkout).
6
- * Version: 1.1.0
7
  * Author: Automattic
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2016 WooCommerce / PayPal.
@@ -36,7 +36,7 @@ function wc_gateway_ppec() {
36
  if ( ! isset( $plugin ) ) {
37
  require_once( 'includes/class-wc-gateway-ppec-plugin.php' );
38
 
39
- $plugin = new WC_Gateway_PPEC_Plugin( __FILE__, '1.1.0' );
40
  }
41
 
42
  return $plugin;
3
  * Plugin Name: WooCommerce PayPal Express Checkout Gateway
4
  * Plugin URI: https://www.woothemes.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: A payment gateway for PayPal Express Checkout (https://www.paypal.com/us/webapps/mpp/express-checkout).
6
+ * Version: 1.1.1
7
  * Author: Automattic
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2016 WooCommerce / PayPal.
36
  if ( ! isset( $plugin ) ) {
37
  require_once( 'includes/class-wc-gateway-ppec-plugin.php' );
38
 
39
+ $plugin = new WC_Gateway_PPEC_Plugin( __FILE__, '1.1.1' );
40
  }
41
 
42
  return $plugin;