Easy Digital Downloads - Version 2.5.2

Version Description

Download this release

Release Info

Developer mordauk
Plugin Icon 128x128 Easy Digital Downloads
Version 2.5.2
Comparing to
See all releases

Code changes from version 2.5.1 to 2.5.2

easy-digital-downloads.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Serve Digital Downloads Through WordPress.
6
  * Author: Pippin Williamson and Company
7
  * Author URI: https://easydigitaldownloads.com
8
- * Version: 2.5.1
9
  * Text Domain: easy-digital-downloads
10
  * Domain Path: languages
11
  *
@@ -25,7 +25,7 @@
25
  * @package EDD
26
  * @category Core
27
  * @author Pippin Williamson
28
- * @version 2.5.1
29
  */
30
 
31
  // Exit if accessed directly.
@@ -186,7 +186,7 @@ final class Easy_Digital_Downloads {
186
 
187
  // Plugin version.
188
  if ( ! defined( 'EDD_VERSION' ) ) {
189
- define( 'EDD_VERSION', '2.5.1' );
190
  }
191
 
192
  // Plugin Folder Path.
5
  * Description: Serve Digital Downloads Through WordPress.
6
  * Author: Pippin Williamson and Company
7
  * Author URI: https://easydigitaldownloads.com
8
+ * Version: 2.5.2
9
  * Text Domain: easy-digital-downloads
10
  * Domain Path: languages
11
  *
25
  * @package EDD
26
  * @category Core
27
  * @author Pippin Williamson
28
+ * @version 2.5.2
29
  */
30
 
31
  // Exit if accessed directly.
186
 
187
  // Plugin version.
188
  if ( ! defined( 'EDD_VERSION' ) ) {
189
+ define( 'EDD_VERSION', '2.5.2' );
190
  }
191
 
192
  // Plugin Folder Path.
includes/payments/class-edd-payment.php CHANGED
@@ -691,21 +691,28 @@ final class EDD_Payment {
691
 
692
  case 'fees':
693
 
694
- if ( ! empty( $this->pending[ $key ] ) ) {
695
- foreach ( $this->pending[ $key ] as $fee ) {
696
- switch( $fee['action'] ) {
697
 
698
- case 'add':
699
- $total_increase += $fee['amount'];
700
- break;
701
 
702
- case 'remove':
703
- $total_decrease += $fee['amount'];
704
- break;
705
 
706
- }
 
 
 
 
 
 
 
 
707
 
708
  }
 
709
  }
710
 
711
  break;
@@ -897,23 +904,10 @@ final class EDD_Payment {
897
  $quantity = edd_item_quantities_enabled() ? absint( $args['quantity'] ) : 1;
898
  $amount = round( $item_price * $quantity, edd_currency_decimal_filter() );
899
 
900
- if ( ! empty( $args['fees'] ) ) {
901
- foreach ( $args['fees'] as $key => $fee ) {
902
-
903
- if ( empty( $fee['download_id'] ) ) {
904
- $args['fees'][ $key ]['download_id'] = $download_id;
905
- }
906
-
907
- $this->add_fee( $args['fees'][ $key ], false );
908
-
909
- }
910
- }
911
-
912
  // Setup the downloads meta item
913
  $new_download = array(
914
  'id' => $download->ID,
915
  'quantity' => $quantity,
916
- 'fees' => $args['fees'],
917
  );
918
 
919
  $default_options = array(
@@ -1136,9 +1130,7 @@ final class EDD_Payment {
1136
  );
1137
 
1138
  $fee = wp_parse_args( $args, $default_args );
1139
- if ( true === $global ) {
1140
- $this->fees[] = $fee;
1141
- }
1142
 
1143
 
1144
  $added_fee = $fee;
691
 
692
  case 'fees':
693
 
694
+ if ( 'publish' !== $this->status && 'complete' !== $this->status && 'revoked' !== $this->status ) {
695
+ break;
696
+ }
697
 
698
+ if ( empty( $this->pending[ $key ] ) ) {
699
+ break;
700
+ }
701
 
702
+ foreach ( $this->pending[ $key ] as $fee ) {
 
 
703
 
704
+ switch( $fee['action'] ) {
705
+
706
+ case 'add':
707
+ $total_increase += $fee['amount'];
708
+ break;
709
+
710
+ case 'remove':
711
+ $total_decrease += $fee['amount'];
712
+ break;
713
 
714
  }
715
+
716
  }
717
 
718
  break;
904
  $quantity = edd_item_quantities_enabled() ? absint( $args['quantity'] ) : 1;
905
  $amount = round( $item_price * $quantity, edd_currency_decimal_filter() );
906
 
 
 
 
 
 
 
 
 
 
 
 
 
907
  // Setup the downloads meta item
908
  $new_download = array(
909
  'id' => $download->ID,
910
  'quantity' => $quantity,
 
911
  );
912
 
913
  $default_options = array(
1130
  );
1131
 
1132
  $fee = wp_parse_args( $args, $default_args );
1133
+ $this->fees[] = $fee;
 
 
1134
 
1135
 
1136
  $added_fee = $fee;
includes/payments/functions.php CHANGED
@@ -180,7 +180,9 @@ function edd_insert_payment( $payment_data = array() ) {
180
 
181
  do_action( 'edd_insert_payment', $payment->ID, $payment_data );
182
 
183
- return $payment->ID; // Return the ID
 
 
184
 
185
  // Return false if no payment was inserted
186
  return false;
180
 
181
  do_action( 'edd_insert_payment', $payment->ID, $payment_data );
182
 
183
+ if ( ! empty( $payment->ID ) ) {
184
+ return $payment->ID;
185
+ }
186
 
187
  // Return false if no payment was inserted
188
  return false;
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tags: download, downloads, e-store, eshop, digital downloads, e-downloads, ecomm
7
  Requires at least: 4.0
8
  Tested up to: 4.5
9
 
10
- Stable Tag: 2.5.1
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
@@ -215,6 +215,10 @@ Yes, through the addition of one or more of the add-on payment gateways, you can
215
 
216
  == Changelog ==
217
 
 
 
 
 
218
  = 2.5.1, January 7, 2016 =
219
 
220
  * Fix: Infinite loop in some instances where add_filter() is used by extensions
7
  Requires at least: 4.0
8
  Tested up to: 4.5
9
 
10
+ Stable Tag: 2.5.2
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
215
 
216
  == Changelog ==
217
 
218
+ = 2.5.2, January 8, 2016 =
219
+
220
+ * Fix: Item specific fees applying twice
221
+
222
  = 2.5.1, January 7, 2016 =
223
 
224
  * Fix: Infinite loop in some instances where add_filter() is used by extensions