Easy Digital Downloads - Version 2.7.2

Version Description

Download this release

Release Info

Developer cklosows
Plugin Icon 128x128 Easy Digital Downloads
Version 2.7.2
Comparing to
See all releases

Code changes from version 2.7.1 to 2.7.2

easy-digital-downloads.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: The easiest way to sell digital products with WordPress.
6
  * Author: Easy Digital Downloads
7
  * Author URI: https://easydigitaldownloads.com
8
- * Version: 2.7.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.7.1
29
  */
30
 
31
  // Exit if accessed directly.
@@ -206,7 +206,7 @@ final class Easy_Digital_Downloads {
206
 
207
  // Plugin version.
208
  if ( ! defined( 'EDD_VERSION' ) ) {
209
- define( 'EDD_VERSION', '2.7.1' );
210
  }
211
 
212
  // Plugin Folder Path.
5
  * Description: The easiest way to sell digital products with WordPress.
6
  * Author: Easy Digital Downloads
7
  * Author URI: https://easydigitaldownloads.com
8
+ * Version: 2.7.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.7.2
29
  */
30
 
31
  // Exit if accessed directly.
206
 
207
  // Plugin version.
208
  if ( ! defined( 'EDD_VERSION' ) ) {
209
+ define( 'EDD_VERSION', '2.7.2' );
210
  }
211
 
212
  // Plugin Folder Path.
includes/admin/reporting/export/export-actions.php CHANGED
@@ -77,7 +77,7 @@ function edd_register_batch_exporters() {
77
  do_action( 'edd_register_batch_exporter' );
78
  }
79
  }
80
- add_action( 'plugins_loaded', 'edd_register_batch_exporters' );
81
 
82
  /**
83
  * Register the payments batch exporter
@@ -176,6 +176,29 @@ function edd_include_file_downloads_batch_processer( $class ) {
176
 
177
  }
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  /**
180
  * Register the earnings report batch exporter
181
  *
@@ -198,6 +221,7 @@ function edd_include_earnings_report_batch_processer( $class ) {
198
  require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-earnings-report.php';
199
  }
200
  }
 
201
  /**
202
  * Register the API requests batch exporter
203
  *
@@ -219,4 +243,4 @@ function edd_include_api_requests_batch_processer( $class ) {
219
  if ( 'EDD_Batch_API_Requests_Export' === $class ) {
220
  require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-api-requests.php';
221
  }
222
- }
77
  do_action( 'edd_register_batch_exporter' );
78
  }
79
  }
80
+ add_action( 'plugins_loaded', 'edd_register_batch_exporters', 99 );
81
 
82
  /**
83
  * Register the payments batch exporter
176
 
177
  }
178
 
179
+ /**
180
+ * Register the sales batch exporter
181
+ *
182
+ * @since 2.7
183
+ */
184
+ function edd_register_sales_export_batch_export() {
185
+ add_action( 'edd_batch_export_class_include', 'edd_include_sales_export_batch_processer', 10, 1 );
186
+ }
187
+ add_action( 'edd_register_batch_exporter', 'edd_register_sales_export_batch_export', 10 );
188
+
189
+ /**
190
+ * Loads the sales export batch process if needed
191
+ *
192
+ * @since 2.7
193
+ * @param string $class The class being requested to run for the batch export
194
+ * @return void
195
+ */
196
+ function edd_include_sales_export_batch_processer( $class ) {
197
+ if ( 'EDD_Batch_Sales_Export' === $class ) {
198
+ require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-sales.php';
199
+ }
200
+ }
201
+
202
  /**
203
  * Register the earnings report batch exporter
204
  *
221
  require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-earnings-report.php';
222
  }
223
  }
224
+
225
  /**
226
  * Register the API requests batch exporter
227
  *
243
  if ( 'EDD_Batch_API_Requests_Export' === $class ) {
244
  require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-api-requests.php';
245
  }
246
+ }
includes/class-edd-download.php CHANGED
@@ -383,7 +383,6 @@ class EDD_Download {
383
  * @return array List of download files
384
  */
385
  public function get_files( $variable_price_id = null ) {
386
-
387
  if( ! isset( $this->files ) ) {
388
 
389
  $this->files = array();
@@ -536,6 +535,7 @@ class EDD_Download {
536
  * @return array List of bundled downloads
537
  */
538
  public function get_variable_priced_bundled_downloads( $price_id = null ) {
 
539
  if ( null == $price_id ) {
540
  return $this->get_bundled_downloads();
541
  }
@@ -545,6 +545,7 @@ class EDD_Download {
545
  $price_assignments = $this->get_bundle_pricing_variations();
546
  $price_assignments = $price_assignments[0];
547
 
 
548
  $price_assignments = array_values( $price_assignments );
549
 
550
  foreach ( $price_assignments as $key => $value ) {
383
  * @return array List of download files
384
  */
385
  public function get_files( $variable_price_id = null ) {
 
386
  if( ! isset( $this->files ) ) {
387
 
388
  $this->files = array();
535
  * @return array List of bundled downloads
536
  */
537
  public function get_variable_priced_bundled_downloads( $price_id = null ) {
538
+
539
  if ( null == $price_id ) {
540
  return $this->get_bundled_downloads();
541
  }
545
  $price_assignments = $this->get_bundle_pricing_variations();
546
  $price_assignments = $price_assignments[0];
547
 
548
+
549
  $price_assignments = array_values( $price_assignments );
550
 
551
  foreach ( $price_assignments as $key => $value ) {
includes/download-functions.php CHANGED
@@ -552,7 +552,6 @@ function edd_is_bundled_product( $download_id = 0 ) {
552
  */
553
  function edd_get_bundled_products( $download_id = 0, $price_id = null ) {
554
  $download = new EDD_Download( $download_id );
555
-
556
  if ( null !== $price_id ) {
557
  return $download->get_variable_priced_bundled_downloads( $price_id );
558
  } else {
552
  */
553
  function edd_get_bundled_products( $download_id = 0, $price_id = null ) {
554
  $download = new EDD_Download( $download_id );
 
555
  if ( null !== $price_id ) {
556
  return $download->get_variable_priced_bundled_downloads( $price_id );
557
  } else {
includes/payments/class-edd-payment.php CHANGED
@@ -1817,11 +1817,18 @@ class EDD_Payment {
1817
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure
1818
  */
1819
  public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
 
1820
  if ( empty( $meta_key ) ) {
1821
  return false;
1822
  }
1823
 
1824
- if ( $meta_key == 'key' || $meta_key == 'date' ) {
 
 
 
 
 
 
1825
 
1826
  $current_meta = $this->get_meta();
1827
  $current_meta[ $meta_key ] = $meta_value;
1817
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure
1818
  */
1819
  public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1820
+
1821
  if ( empty( $meta_key ) ) {
1822
  return false;
1823
  }
1824
 
1825
+ if( '_edd_payment_purchase_key' == $meta_key ) {
1826
+
1827
+ $current_meta = $this->get_meta();
1828
+ $current_meta[ 'key' ] = $meta_value;
1829
+ update_post_meta( $this->ID, '_edd_payment_meta', $current_meta );
1830
+
1831
+ } else if ( $meta_key == 'key' || $meta_key == 'date' ) {
1832
 
1833
  $current_meta = $this->get_meta();
1834
  $current_meta[ $meta_key ] = $meta_value;
includes/payments/class-payments-query.php CHANGED
@@ -32,6 +32,14 @@ class EDD_Payments_Query extends EDD_Stats {
32
  */
33
  public $args = array();
34
 
 
 
 
 
 
 
 
 
35
  /**
36
  * The payments found based on the criteria set
37
  *
@@ -75,7 +83,8 @@ class EDD_Payments_Query extends EDD_Stats {
75
  'download' => null
76
  );
77
 
78
- $this->args = wp_parse_args( $args, $defaults );
 
79
 
80
  $this->init();
81
  }
32
  */
33
  public $args = array();
34
 
35
+ /**
36
+ * The args as they came into the class.
37
+ *
38
+ * @var array
39
+ * @since 2.7.2
40
+ */
41
+ public $initial_args = array();
42
+
43
  /**
44
  * The payments found based on the criteria set
45
  *
83
  'download' => null
84
  );
85
 
86
+ // We need to store an array of the args used to instantiate the class, so that we can use it in later hooks.
87
+ $this->args = $this->initial_args = wp_parse_args( $args, $defaults );
88
 
89
  $this->init();
90
  }
includes/process-purchase.php CHANGED
@@ -80,6 +80,17 @@ function edd_process_purchase_form() {
80
  $card_state = isset( $valid_data['cc_info']['card_state'] ) ? $valid_data['cc_info']['card_state'] : false;
81
  $card_zip = isset( $valid_data['cc_info']['card_zip'] ) ? $valid_data['cc_info']['card_zip'] : false;
82
 
 
 
 
 
 
 
 
 
 
 
 
83
  // Setup purchase information
84
  $purchase_data = array(
85
  'downloads' => edd_get_cart_contents(),
@@ -89,7 +100,7 @@ function edd_process_purchase_form() {
89
  'tax' => edd_get_cart_tax(), // Taxed amount
90
  'tax_rate' => edd_get_cart_tax_rate( $card_country, $card_state, $card_zip ), // Tax rate
91
  'price' => edd_get_cart_total(), // Amount after taxes
92
- 'purchase_key' => strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'edd', true ) ) ), // Unique key
93
  'user_email' => $user['user_email'],
94
  'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
95
  'user_info' => stripslashes_deep( $user_info ),
80
  $card_state = isset( $valid_data['cc_info']['card_state'] ) ? $valid_data['cc_info']['card_state'] : false;
81
  $card_zip = isset( $valid_data['cc_info']['card_zip'] ) ? $valid_data['cc_info']['card_zip'] : false;
82
 
83
+ // Set up the unique purchase key. If we are resuming a payment, we'll overwrite this with the existing key.
84
+ $purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'edd', true ) ) );
85
+ $existing_payment = EDD()->session->get( 'edd_resume_payment' );
86
+
87
+ if ( ! empty( $existing_payment ) ) {
88
+ $payment = new EDD_Payment( $existing_payment );
89
+ if( $payment->is_recoverable() && ! empty( $payment->key ) ) {
90
+ $purchase_key = $payment->key;
91
+ }
92
+ }
93
+
94
  // Setup purchase information
95
  $purchase_data = array(
96
  'downloads' => edd_get_cart_contents(),
100
  'tax' => edd_get_cart_tax(), // Taxed amount
101
  'tax_rate' => edd_get_cart_tax_rate( $card_country, $card_state, $card_zip ), // Tax rate
102
  'price' => edd_get_cart_total(), // Amount after taxes
103
+ 'purchase_key' => $purchase_key,
104
  'user_email' => $user['user_email'],
105
  'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
106
  'user_info' => stripslashes_deep( $user_info ),
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://easydigitaldownloads.com/donate/
6
  Tags: download, downloads, e-store, eshop, digital downloads, e-commerce, wp-ecommerce, wp ecommerce
7
  Requires at least: 4.0
8
  Tested up to: 4.8
9
- Stable Tag: 2.7.1
10
 
11
  License: GNU Version 2 or Any Later Version
12
 
@@ -194,6 +194,11 @@ Yes, through the addition of one or more of the add-on payment gateways, you can
194
 
195
  == Changelog ==
196
 
 
 
 
 
 
197
  = 2.7.1, February 14, 2017 =
198
  * Fix: Checkout was showing wrong total price when certain fees were applied to the cart.
199
  * Fix: Plugin row meta linked to non-existent "Getting Started" page.
6
  Tags: download, downloads, e-store, eshop, digital downloads, e-commerce, wp-ecommerce, wp ecommerce
7
  Requires at least: 4.0
8
  Tested up to: 4.8
9
+ Stable Tag: 2.7.2
10
 
11
  License: GNU Version 2 or Any Later Version
12
 
194
 
195
  == Changelog ==
196
 
197
+ = 2.7.2, February 15, 2017 =
198
+ * Fix: It was possible for the batch exporter base class to not be loaded before it was trying to be used.
199
+ * Fix: Payments completed with the 'resume payment' feature prevented file download links from working.
200
+ * New: EDD_Payments_Query now keeps a record of the initial arguments used, to allow better extensibility.
201
+
202
  = 2.7.1, February 14, 2017 =
203
  * Fix: Checkout was showing wrong total price when certain fees were applied to the cart.
204
  * Fix: Plugin row meta linked to non-existent "Getting Started" page.