updated plugin Easy Digital Downloads version 3.1.1.3

This commit is contained in:
2023-03-29 18:20:17 +00:00
committed by Gitium
parent 2573ae37c7
commit e42ba0e05a
20 changed files with 234 additions and 155 deletions

View File

@ -858,6 +858,12 @@ class EDD_Payment_History_Table extends List_Table {
'type' => $type,
) );
// If no specific ordering has been requested, order by `date_created`.
if ( empty( $_GET['orderby'] ) ) {
$args['orderby'] = 'date_created';
$args['order'] = 'DESC';
}
// Update args by search query.
if ( ! empty( $search ) ) {
$args = $this->parse_search( $search, $args );

View File

@ -355,7 +355,7 @@ final class Easy_Digital_Downloads {
// Plugin version.
if ( ! defined( 'EDD_VERSION' ) ) {
define( 'EDD_VERSION', '3.1.1.2' );
define( 'EDD_VERSION', '3.1.1.3' );
}
// Make sure CAL_GREGORIAN is defined.

View File

@ -69,9 +69,6 @@ final class EDD_Requirements_Check {
$this->file = EDD_PLUGIN_FILE;
$this->base = EDD_PLUGIN_BASE;
// Always load translations
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
// Load or quit
$this->met()
? $this->load()
@ -416,6 +413,9 @@ final class EDD_Requirements_Check {
/**
* Plugin specific text-domain loader.
*
* @deprecated 3.1.1.3. Since EDD no longer bundles any language files,
* and WordPress Core automatically loads the custom wp-content/languages/easy-digital-downloads/.mo file if it's found,
* this is no longer needed.
* @since 1.4
* @return void
*/
@ -492,6 +492,7 @@ final class EDD_Requirements_Check {
/**
* Load a .mo file for the old textdomain if one exists.
*
* @deprecated 3.1.1.3
* @see https://github.com/10up/grunt-wp-plugin/issues/21#issuecomment-62003284
*/
public function load_old_textdomain( $mofile, $textdomain ) {

View File

@ -846,30 +846,8 @@ abstract class Table extends Base {
*/
private function get_db_version() {
$this->db_version = $this->is_global()
? get_network_option( get_main_network_id(), $this->db_version_key, false )
: get_option( $this->db_version_key, false );
/**
* If the DB version is higher than the stated version and is 12 digits
* long, we need to update it to our new, shorter format of 9 digits.
*
* This is only for 3.0 beta testers, and can be removed in 3.0.1 or above.
*
* @link https://github.com/easydigitaldownloads/easy-digital-downloads/issues/7579
*/
if ( version_compare( $this->db_version, $this->version, '<=' ) || ( 12 !== strlen( $this->db_version ) ) ) {
return;
}
// Parse the new version number from the existing. Converting from
// {YYYY}{mm}{dd}{xxxx} to {YYYY}{mm}{dd}{x}
$date = substr( $this->db_version, 0, 8 );
$increment = substr( $this->db_version, 8, 4 );
// Trims off the three prefixed zeros.
$this->db_version = intval( $date . intval( $increment ) );
$this->set_db_version( $this->db_version );
? get_network_option( get_main_network_id(), $this->db_version_key, 1 )
: get_option( $this->db_version_key, 1 );
}
/**

View File

@ -38,7 +38,7 @@ final class Customers extends Table {
* @since 3.0
* @var int
*/
protected $version = 202301021;
protected $version = 202303220;
/**
* Array of upgrade versions and methods
@ -48,9 +48,9 @@ final class Customers extends Table {
* @var array
*/
protected $upgrades = array(
'202002141' => 202002141,
'202006101' => 202006101,
'202301021' => 202301021,
'202303220' => 202303220,
);
/**
@ -248,4 +248,18 @@ final class Customers extends Table {
return $this->is_success( $return_result );
}
/**
* Upgrades the customer database for sites which got into a bit of a snarl with the database versions.
*
* @since 3.1.1.3
* @return bool
*/
protected function __202303220() {
if ( $this->needs_initial_upgrade() ) {
return $this->__202301021();
}
return true;
}
}

View File

@ -3,7 +3,7 @@
* Plugin Name: Easy Digital Downloads - Stripe Pro Payment Gateway
* Plugin URI: https://easydigitaldownloads.com/downloads/stripe-gateway/
* Description: Adds a payment gateway for Stripe.com
* Version: 2.9.2
* Version: 2.9.2.1
* Requires at least: 5.4
* Requires PHP: 7.1
* Author: Easy Digital Downloads
@ -44,7 +44,7 @@ function edd_stripe_core_bootstrap() {
}
if ( ! defined( 'EDD_STRIPE_VERSION' ) ) {
define( 'EDD_STRIPE_VERSION', '2.9.2' );
define( 'EDD_STRIPE_VERSION', '2.9.2.1' );
}
if ( ! defined( 'EDD_STRIPE_API_VERSION' ) ) {

View File

@ -112,12 +112,16 @@ function edds_add_settings( $settings ) {
'type' => 'text',
),
'stripe_restrict_assets' => array(
'id' => 'stripe_restrict_assets',
'name' => ( __( 'Restrict Stripe Assets', 'easy-digital-downloads' ) ),
'desc' => ( __( 'Only load Stripe.com hosted assets on pages that specifically utilize Stripe functionality.', 'easy-digital-downloads' ) ),
'type' => 'checkbox',
'tooltip_title' => __( 'Loading Javascript from Stripe', 'easy-digital-downloads' ),
'tooltip_desc' => __( 'Stripe advises that their Javascript library be loaded on every page to take advantage of their advanced fraud detection rules. If you are not concerned with this, enable this setting to only load the Javascript when necessary. Read more about Stripe\'s recommended setup here: https://stripe.com/docs/web/setup.', 'easy-digital-downloads' ),
'id' => 'stripe_restrict_assets',
'name' => ( __( 'Restrict Stripe Assets', 'easy-digital-downloads' ) ),
'check' => ( __( 'Only load Stripe.com hosted assets on pages that specifically utilize Stripe functionality.', 'easy-digital-downloads' ) ),
'type' => 'checkbox_description',
'desc' => sprintf(
/* translators: 1. opening link tag; 2. closing link tag */
__( 'Stripe advises that their Javascript library be loaded on every page to take advantage of their advanced fraud detection rules. If you are not concerned with this, enable this setting to only load the Javascript when necessary. %1$sLearn more about Stripe\'s recommended setup.%2$s', 'easy-digital-downloads' ),
'<a href="https://stripe.com/docs/web/setup" target="_blank" rel="noopener noreferrer">',
'</a>'
),
),
);

View File

@ -226,14 +226,15 @@ function edds_get_stripe_payment_elements_fonts() {
*/
function edds_gather_payment_element_customizations() {
$customizations = array(
'theme' => edds_get_stripe_payment_elements_theme(),
'variables' => edds_get_stripe_payment_elements_variables(),
'rules' => edds_get_stripe_payment_elements_rules(),
'layout' => edds_get_stripe_payment_elements_layout(),
'wallets' => edds_get_stripe_payment_elements_wallets(),
'labels' => edds_get_stripe_payment_elements_label_style(),
'fonts' => edds_get_stripe_payment_elements_fonts(),
'i18n' => array(
'theme' => edds_get_stripe_payment_elements_theme(),
'variables' => edds_get_stripe_payment_elements_variables(),
'rules' => edds_get_stripe_payment_elements_rules(),
'layout' => edds_get_stripe_payment_elements_layout(),
'wallets' => edds_get_stripe_payment_elements_wallets(),
'labels' => edds_get_stripe_payment_elements_label_style(),
'fonts' => edds_get_stripe_payment_elements_fonts(),
'paymentMethodTypes' => edds_payment_element_payment_method_types(),
'i18n' => array(
'errorMessages' => edds_get_localized_error_messages(),
),
);
@ -260,3 +261,37 @@ function edds_payment_element_js_vars( $stripe_vars ) {
return $stripe_vars;
}
add_filter( 'edd_stripe_js_vars', 'edds_payment_element_js_vars', 10, 1 );
/**
* Returns an array of payment method types.
*
* By default this is empty to allow the automatic payment methods to take over, but in the event someone
* wants to alter this, they can at their own risk as EDD controls what payment methods are availbale
* at the platform level.
*
* As of 2.9.2.1 - EDD only supports 'card' and 'link' as options.
*
* @since 2.9.2.1
*
* @return array The allowed payment_method_types
*/
function edds_payment_element_payment_method_types() {
/**
* Allows passing payment_method_types to the elements and intent.
*
* This is by default empty, but you can alter this on an account level if needed.
*
* @since 2.9.2.1
*
* @example
* add_filter( 'edds_stripe_payment_elements_payment_method_types', function( $payment_method_types ) {
* return array(
* 'card',
* 'link',
* );
* } );
*
* @param array The allowed payment elements payment method types.
*/
return apply_filters( 'edds_stripe_payment_elements_payment_method_types', array() );
}

View File

@ -152,12 +152,13 @@ function edds_process_purchase_form( $purchase_data ) {
if ( ! empty( $_REQUEST['payment_method_id'] ) ) {
$intent_args['payment_method'] = sanitize_text_field( $_REQUEST['payment_method_id'] );
} else {
$payment_method_types = array(
'card',
'link',
);
$payment_method_types = edds_payment_element_payment_method_types();
$intent_args['payment_method_types'] = $payment_method_types;
if ( ! empty( $payment_method_types ) ) {
$intent_args['payment_method_types'] = $payment_method_types;
} else {
$intent_args['automatic_payment_methods'] = array( 'enabled' => true );
}
}
// Create a SetupIntent for a non-payment carts.

View File

@ -3,7 +3,7 @@
'name' => 'easy-digital-downloads/edd-stripe',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'a63eec57c1f5da47c09cc9cd8cf4162f8c65652a',
'reference' => '47178f1567076390fc6f41a5c5ebdf986b915165',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -13,7 +13,7 @@
'easy-digital-downloads/edd-stripe' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'a63eec57c1f5da47c09cc9cd8cf4162f8c65652a',
'reference' => '47178f1567076390fc6f41a5c5ebdf986b915165',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),

View File

@ -848,7 +848,7 @@ function edd_process_profile_editor_updates( $data ) {
$customers = edd_get_customers(
array(
'email' => $email,
'user_id__not_in' => $user_id,
'user_id__not_in' => array( $user_id ),
)
);
// Make sure the new email doesn't belong to another user.