updated plugin Easy Digital Downloads version 3.1.2

This commit is contained in:
2023-06-28 12:45:44 +00:00
committed by Gitium
parent 44df590080
commit f710fa7de2
120 changed files with 5556 additions and 3347 deletions

View File

@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '75153cfac5e884f38a28');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '9575575720727823baf2');

View File

@ -1 +1 @@
.edd-no-js{display:none!important}svg.edd-blocks__icon{fill:none!important}.editor-styles-wrapper .components-placeholder a.components-button.edd-new-download{background-color:var(--wp-admin-theme-color)!important;color:#fff!important;line-height:1.5;margin:0 auto!important;padding:.5em 1em;text-decoration:none}.editor-styles-wrapper .wp-block.wp-block-edd-buy-button .components-placeholder{align-items:center;background-color:#fefefe;border-radius:5px}.editor-styles-wrapper .wp-block.wp-block-edd-buy-button .components-placeholder__fieldset{justify-content:center}
.edd-no-js{display:none!important}svg.edd-blocks__icon{fill:none!important}.editor-styles-wrapper .components-placeholder{align-items:center;background-color:#fefefe;border-radius:5px}.editor-styles-wrapper .components-placeholder__fieldset{justify-content:center}.editor-styles-wrapper .components-placeholder div.edd-downloads--actions{display:flex;gap:2em;justify-content:space-around}.editor-styles-wrapper .components-placeholder div.edd-downloads--actions a.components-button{line-height:1.5;margin-right:0;padding:.5em 1em;text-decoration:none}.editor-styles-wrapper .components-placeholder div.edd-downloads--actions a.components-button.edd-downloads--primary{background-color:var(--wp-admin-theme-color);color:#fff}.editor-styles-wrapper .components-placeholder div.edd-downloads--actions a.components-button.edd-downloads--secondary{background-color:#fff;border:1px solid var(--wp-admin-theme-color);color:var(--wp-admin-theme-color)}.editor-styles-wrapper .wp-block.wp-block-edd-buy-button .components-placeholder{align-items:center;background-color:#fefefe;border-radius:5px}.editor-styles-wrapper .wp-block.wp-block-edd-buy-button .components-placeholder__fieldset{justify-content:center}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
.edd-blocks-form__cart .edd_cart_remove_item_btn{border:none;margin-left:.5rem;padding:0;text-decoration:none}.edd-blocks-form__cart .edd_cart_remove_item_btn svg{opacity:.6}.edd-blocks-form__cart .edd_cart_remove_item_btn svg:hover{opacity:.9}.edd-blocks-form__cart #edd_checkout_cart{border:1px solid #eee;display:grid}.edd-blocks-form__cart .edd_cart_item_name{display:grid;gap:1rem}.edd-blocks-form__cart .edd_cart_item_name .edd_cart_actions{align-items:center;display:inline-flex;flex-basis:100%;gap:.5rem}.edd-blocks-form__cart .edd_cart_item_name .edd_cart_actions label{margin:0!important}.edd-blocks-form__cart .edd_cart_item_name .edd_cart_actions input.edd-item-quantity{width:3rem!important}.edd-blocks-form__cart .edd_checkout_cart_item_title{align-items:center;display:flex;gap:1rem}.edd-blocks-form__cart .edd_cart_fee_amount,.edd-blocks-form__cart .edd_cart_item_price{align-items:center;display:flex;gap:.5rem}@media(min-width:480px){.edd-blocks-form__cart .edd_cart_fee_amount,.edd-blocks-form__cart .edd_cart_item_price{justify-content:flex-end}}.edd-blocks-form__cart .edd-blocks-cart__row{align-items:center;display:flex;flex-wrap:wrap;gap:1rem;padding:1.5rem}.edd-blocks-form__cart .edd-blocks-cart__row>div:last-of-type:not(:first-of-type){flex:1 1 110px}@media(min-width:480px){.edd-blocks-form__cart .edd-blocks-cart__row>div:last-of-type:not(:first-of-type){text-align:right}}.edd-blocks-form__cart .edd-blocks-cart__items,.edd-blocks-form__cart .edd-blocks-cart__row-header{border-bottom:1px solid #eee}.edd-blocks-form__cart .edd-blocks-cart__row-header,.edd-blocks-form__cart .edd_cart_total{font-weight:700}.edd-blocks-form__cart .edd-blocks-cart__row-footer{text-align:right}.edd-blocks-form__cart .edd-blocks-cart__row-footer>div:only-child{flex-grow:1}.edd-blocks-form__cart .edd-blocks-cart__action-remove,.edd-blocks-form__cart .edd_discount_remove{background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSJub25lIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2U9ImN1cnJlbnRDb2xvciIgY2xhc3M9InctNiBoLTYiPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTE0Ljc0IDlsLS4zNDYgOW0tNC43ODggMEw5LjI2IDltOS45NjgtMy4yMWMuMzQyLjA1Mi42ODIuMTA3IDEuMDIyLjE2Nm0tMS4wMjItLjE2NUwxOC4xNiAxOS42NzNhMi4yNSAyLjI1IDAgMDEtMi4yNDQgMi4wNzdIOC4wODRhMi4yNSAyLjI1IDAgMDEtMi4yNDQtMi4wNzdMNC43NzIgNS43OW0xNC40NTYgMGE0OC4xMDggNDguMTA4IDAgMDAtMy40NzgtLjM5N20tMTIgLjU2MmMuMzQtLjA1OS42OC0uMTE0IDEuMDIyLS4xNjVtMCAwYTQ4LjExIDQ4LjExIDAgMDEzLjQ3OC0uMzk3bTcuNSAwdi0uOTE2YzAtMS4xOC0uOTEtMi4xNjQtMi4wOS0yLjIwMWE1MS45NjQgNTEuOTY0IDAgMDAtMy4zMiAwYy0xLjE4LjAzNy0yLjA5IDEuMDIyLTIuMDkgMi4yMDF2LjkxNm03LjUgMGE0OC42NjcgNDguNjY3IDAgMDAtNy41IDAiIC8+Cjwvc3ZnPgo=) 50% no-repeat;background-size:1em;box-shadow:none!important;display:block;height:1em;opacity:.6;top:0;width:1em}.edd-blocks-form__cart .edd-blocks-cart__action-remove:hover,.edd-blocks-form__cart .edd_discount_remove:hover{background-position:50%;opacity:1}.edd-blocks-form__cart .edd_cart_item_image img{display:block}.edd-blocks__cart-mini,.edd-blocks__cart-mini a{align-items:center;color:unset;display:flex;gap:.25rem;justify-content:flex-end;text-decoration:none}.edd-blocks__cart-mini a svg,.edd-blocks__cart-mini svg{fill:none;height:1.5rem;width:1.5rem}.wp-block-edd-cart .edd-blocks-cart__row-footer{padding:.5rem 1.5rem}
.edd-blocks-form__cart .edd_cart_remove_item_btn{border:none;margin-left:.5rem;padding:0;text-decoration:none}.edd-blocks-form__cart .edd_cart_remove_item_btn svg{opacity:.6}.edd-blocks-form__cart .edd_cart_remove_item_btn svg:hover{opacity:.9}.edd-blocks-form__cart #edd_checkout_cart{border:1px solid #eee;display:grid}.edd-blocks-form__cart .edd_cart_item_name{display:grid;gap:1rem}.edd-blocks-form__cart .edd_cart_item_name .edd_cart_actions{align-items:center;display:inline-flex;flex-basis:100%;gap:.5rem}.edd-blocks-form__cart .edd_cart_item_name .edd_cart_actions label{margin:0!important}.edd-blocks-form__cart .edd_cart_item_name .edd_cart_actions input.edd-item-quantity{width:3rem!important}.edd-blocks-form__cart .edd_checkout_cart_item_title{align-items:center;display:flex;gap:1rem}.edd-blocks-form__cart .edd_cart_fee_amount,.edd-blocks-form__cart .edd_cart_item_price{align-items:center;display:flex;gap:.5rem}@media(min-width:480px){.edd-blocks-form__cart .edd_cart_fee_amount,.edd-blocks-form__cart .edd_cart_item_price{justify-content:flex-end}}.edd-blocks-form__cart .edd-blocks-cart__row,.edd-blocks-form__cart .edd_cart_footer_row{align-items:center;display:flex;flex-wrap:wrap;gap:1rem;padding:1.5rem}.edd-blocks-form__cart .edd-blocks-cart__row>div:last-of-type:not(:first-of-type),.edd-blocks-form__cart .edd_cart_footer_row>div:last-of-type:not(:first-of-type){flex:1 1 110px}@media(min-width:480px){.edd-blocks-form__cart .edd-blocks-cart__row>div:last-of-type:not(:first-of-type),.edd-blocks-form__cart .edd_cart_footer_row>div:last-of-type:not(:first-of-type){text-align:right}}.edd-blocks-form__cart .edd-blocks-cart__items,.edd-blocks-form__cart .edd-blocks-cart__row-header{border-bottom:1px solid #eee}.edd-blocks-form__cart .edd-blocks-cart__row-header,.edd-blocks-form__cart .edd_cart_total{font-weight:700}.edd-blocks-form__cart .edd-blocks-cart__row-footer{text-align:right}.edd-blocks-form__cart .edd-blocks-cart__row-footer>div:only-child{flex-grow:1}.edd-blocks-form__cart .edd-blocks-cart__action-remove,.edd-blocks-form__cart .edd_discount_remove{background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSJub25lIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2U9ImN1cnJlbnRDb2xvciIgY2xhc3M9InctNiBoLTYiPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTE0Ljc0IDlsLS4zNDYgOW0tNC43ODggMEw5LjI2IDltOS45NjgtMy4yMWMuMzQyLjA1Mi42ODIuMTA3IDEuMDIyLjE2Nm0tMS4wMjItLjE2NUwxOC4xNiAxOS42NzNhMi4yNSAyLjI1IDAgMDEtMi4yNDQgMi4wNzdIOC4wODRhMi4yNSAyLjI1IDAgMDEtMi4yNDQtMi4wNzdMNC43NzIgNS43OW0xNC40NTYgMGE0OC4xMDggNDguMTA4IDAgMDAtMy40NzgtLjM5N20tMTIgLjU2MmMuMzQtLjA1OS42OC0uMTE0IDEuMDIyLS4xNjVtMCAwYTQ4LjExIDQ4LjExIDAgMDEzLjQ3OC0uMzk3bTcuNSAwdi0uOTE2YzAtMS4xOC0uOTEtMi4xNjQtMi4wOS0yLjIwMWE1MS45NjQgNTEuOTY0IDAgMDAtMy4zMiAwYy0xLjE4LjAzNy0yLjA5IDEuMDIyLTIuMDkgMi4yMDF2LjkxNm03LjUgMGE0OC42NjcgNDguNjY3IDAgMDAtNy41IDAiIC8+Cjwvc3ZnPgo=) 50% no-repeat;background-size:1em;box-shadow:none!important;display:block;height:1em;opacity:.6;top:0;width:1em}.edd-blocks-form__cart .edd-blocks-cart__action-remove:hover,.edd-blocks-form__cart .edd_discount_remove:hover{background-position:50%;opacity:1}.edd-blocks-form__cart .edd_cart_item_image img{display:block}.edd-blocks__cart-mini,.edd-blocks__cart-mini a{align-items:center;color:unset;display:flex;gap:.25rem;justify-content:flex-end;text-decoration:none}.edd-blocks__cart-mini a svg,.edd-blocks__cart-mini svg{fill:none;height:1.5rem;width:1.5rem}.wp-block-edd-cart .edd-blocks-cart__row-footer{padding:.5rem 1.5rem}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '2066313c4795ca117892');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '21903bcd30e08c89eb77');

View File

@ -1 +1 @@
.edd-no-js{display:none!important}svg.edd-blocks__icon{fill:none!important}.editor-styles-wrapper .components-placeholder a.components-button.edd-new-download{background-color:var(--wp-admin-theme-color)!important;color:#fff!important;line-height:1.5;margin:0 auto!important;padding:.5em 1em;text-decoration:none}.edd-blocks-term-selector select{min-height:60px!important}.edd-blocks-term-selector svg{display:none!important}
.edd-no-js{display:none!important}svg.edd-blocks__icon{fill:none!important}.editor-styles-wrapper .components-placeholder{align-items:center;background-color:#fefefe;border-radius:5px}.editor-styles-wrapper .components-placeholder__fieldset{justify-content:center}.editor-styles-wrapper .components-placeholder div.edd-downloads--actions{display:flex;gap:2em;justify-content:space-around}.editor-styles-wrapper .components-placeholder div.edd-downloads--actions a.components-button{line-height:1.5;margin-right:0;padding:.5em 1em;text-decoration:none}.editor-styles-wrapper .components-placeholder div.edd-downloads--actions a.components-button.edd-downloads--primary{background-color:var(--wp-admin-theme-color);color:#fff}.editor-styles-wrapper .components-placeholder div.edd-downloads--actions a.components-button.edd-downloads--secondary{background-color:#fff;border:1px solid var(--wp-admin-theme-color);color:var(--wp-admin-theme-color)}.edd-blocks-term-selector select{min-height:60px!important}.edd-blocks-term-selector svg{display:none!important}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => 'b5c8776e3d561d9f287e');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => 'db173b2cb95eaab8c3ff');

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* Description: Core blocks for Easy Digital Downloads.
* Requires at least: 5.8
* Requires PHP: 7.0
* Version: 2.0.6
* Version: 2.0.7
* Author: Easy Digital Downloads
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html

View File

@ -44,7 +44,7 @@ function register_keys( $settings ) {
$settings['main']['recaptcha_secret_key'] = array(
'id' => 'recaptcha_secret_key',
'name' => __( 'reCAPTCHA Secret Key', 'easy-digital-downloads' ),
'type' => 'text',
'type' => 'password',
'std' => '',
);

View File

@ -12,13 +12,29 @@ add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\localize' );
*/
function localize() {
$user = wp_get_current_user();
$downloads = new \WP_Query(
array(
'post_type' => 'download',
'posts_per_page' => 1,
'post_status' => 'any',
'no_found_rows' => true,
$user = wp_get_current_user();
$download_query_args = array(
'post_type' => 'download',
'posts_per_page' => 1,
'no_found_rows' => true,
);
$published_downloads = new \WP_Query(
array_merge(
$download_query_args,
array(
'post_status' => array( 'publish' ),
)
)
);
$draft_downloads = new \WP_Query(
array_merge(
$download_query_args,
array(
'post_status' => array( 'draft' ),
)
)
);
@ -26,14 +42,18 @@ function localize() {
'wp-block-editor',
'EDDBlocks',
array(
'current_user' => md5( $user->user_email ),
'all_access' => function_exists( 'edd_all_access' ),
'recurring' => function_exists( 'EDD_Recurring' ),
'is_pro' => edd_is_pro(),
'no_redownload' => edd_no_redownload(),
'supports_buy_now' => edd_shop_supports_buy_now(),
'has_downloads' => $downloads->have_posts(),
'new_download' => add_query_arg( 'post_type', 'download', admin_url( 'post-new.php' ) ),
'current_user' => md5( $user->user_email ),
'all_access' => function_exists( 'edd_all_access' ),
'recurring' => function_exists( 'EDD_Recurring' ),
'is_pro' => edd_is_pro(),
'no_redownload' => edd_no_redownload(),
'supports_buy_now' => edd_shop_supports_buy_now(),
'has_published_downloads' => $published_downloads->have_posts(),
'has_draft_downloads' => $draft_downloads->have_posts(),
'new_download_link' => add_query_arg( 'post_type', 'download', admin_url( 'post-new.php' ) ),
'view_downloads_link' => add_query_arg( 'post_type', 'download', admin_url( 'edit.php' ) ),
'download_label_singular' => edd_get_label_singular(),
'download_label_plural' => edd_get_label_plural(),
)
);
}

View File

@ -42,3 +42,27 @@ function get_quantity_string() {
_n( 'item', 'items', $quantity, 'easy-digital-downloads' )
);
}
/**
* Outputs the additional cart data. Table markup is replaced.
*
* @since 2.0
* @param string $action The action being called.
* @param mixed $args
* @return string
*/
function do_cart_action( $action = 'edd_cart_items_after', ...$args ) {
ob_start();
do_action( $action, $args );
$details = ob_get_clean();
if ( empty( $details ) ) {
return;
}
$details = str_replace( '<tr', '<div', $details );
$details = str_replace( '</tr', '</div', $details );
$details = str_replace( '<td', '<div', $details );
$details = str_replace( '</td', '</div', $details );
echo wp_kses_post( $details );
}

View File

@ -413,11 +413,13 @@ function get_purchased_products( $block_attributes ) {
return false;
}
$downloads = array();
$valid_items = array();
$downloads = array();
foreach ( $items as $item ) {
if ( edd_is_bundled_product( $item->product_id ) ) {
$key = ! empty( $block_attributes['variations'] ) ? $item->product_name : edd_get_download_name( $item->product_id );
if ( array_key_exists( $key, $downloads ) ) {
$key = ! empty( $block_attributes['variations'] ) ? $item->product_name : edd_get_download_name( $item->product_id );
$valid_key = $item->product_id;
if ( in_array( $valid_key, $valid_items, true ) ) {
continue;
}
$bundled_products = edd_get_bundled_products( $item->product_id, $item->price_id );
@ -425,6 +427,7 @@ function get_purchased_products( $block_attributes ) {
$product_id = edd_get_bundle_item_id( $bundle_item );
$price_id = edd_get_bundle_item_price_id( $bundle_item );
$key = edd_get_download_name( $product_id );
$valid_key = $product_id;
$order_item_args = array(
'order_id' => $item->order_id,
'status' => $item->status,
@ -444,15 +447,18 @@ function get_purchased_products( $block_attributes ) {
}
}
$order_item_args['price_id'] = $price_id;
$valid_key .= "_{$price_id}";
}
if ( array_key_exists( $key, $downloads ) ) {
if ( in_array( $valid_key, $valid_items, true ) ) {
continue;
}
$valid_items[] = $valid_key;
$downloads[ $key ] = new \EDD\Orders\Order_Item( $order_item_args );
}
continue;
}
$key = $item->product_name;
$key = $item->product_name;
$valid_key = $item->product_id;
if ( is_numeric( $item->price_id ) && edd_has_variable_prices( $item->product_id ) ) {
if ( empty( $block_attributes['variations'] ) ) {
$download_files = edd_get_download_files( $item->product_id, $item->price_id );
@ -460,11 +466,14 @@ function get_purchased_products( $block_attributes ) {
if ( empty( $conditions ) || in_array( 'all', $conditions, true ) ) {
$key = edd_get_download_name( $item->product_id );
}
} else {
$valid_key .= "_{$item->price_id}";
}
}
if ( array_key_exists( $key, $downloads ) ) {
if ( in_array( $valid_key, $valid_items, true ) ) {
continue;
}
$valid_items[] = $valid_key;
$downloads[ $key ] = $item;
}

View File

@ -1,3 +1,6 @@
<?php
use EDD\Blocks\Checkout\Functions as CheckoutFunctions;
?>
<form id="edd_checkout_cart_form" class="edd-blocks-form edd-blocks-form__cart" method="post">
<?php
$cart_classes = array(
@ -30,7 +33,7 @@
if ( edd_cart_has_fees() ) {
include 'cart-fees.php';
}
do_action( 'edd_cart_items_after' );
CheckoutFunctions\do_cart_action( 'edd_cart_items_after' );
if ( edd_use_taxes() && ! edd_prices_include_tax() ) {
include 'cart-subtotal.php';