Merge branch 'trunk' of github.com:woocommerce/woocommerce into try/perf-k6-checkout-poc

This commit is contained in:
Tam Mullen 2021-06-01 15:57:27 +01:00
commit b9037746ac
250 changed files with 5208 additions and 1705 deletions

View File

@ -39,5 +39,4 @@ jobs:
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
run: |
npx wc-e2e docker:up
npx wc-e2e test:e2e

View File

@ -20,3 +20,8 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'needs feedback'
- name: remove stale
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: Stale

View File

@ -161,6 +161,43 @@
}
}
.addons-promotion-block {
display: flex;
padding: 20px;
.addons-img {
height: auto;
width: 200px;
}
}
.addons-promotion-block-content {
display: flex;
flex-direction: column;
margin-left: 24px;
}
.addons-promotion-block-description {
margin-bottom: 20px;
}
.addons-promotion-block-title {
margin: 0 0 16px;
padding: 0;
}
.addons-promotion-block-buttons {
margin-top: auto;
.addons-button {
margin-right: 8px;
&:last-child {
margin-right: 0;
}
}
}
.addons-shipping-methods .addons-wcs-banner-block {
margin-left: 0;
margin-right: 0;
@ -364,6 +401,12 @@
color: #fff;
}
.addons-button-expandable {
display: inline-block;
padding: 0 16px;
width: auto;
}
.addons-button-solid:hover {
color: #fff;
opacity: 0.8;
@ -2642,6 +2685,30 @@ ul.wc_coupon_list_block {
float: right;
}
}
.wc_addons_wrap {
.addons-promotion-block {
flex-direction: column;
padding: 24px;
.addons-img {
height: auto;
width: 100%;
max-width: 240px;
margin: 0 auto 20px;
}
}
.addons-promotion-block-content {
display: block;
margin-left: 0;
}
.addons-promotion-block-title {
margin-top: 4px;
}
}
}
.column-customer_message .note-on {

View File

@ -53,7 +53,7 @@
.on( 'click', css_class, function( evt ) {
evt.preventDefault();
if ( ! document.queryCommandSupported( 'copy' ) ) {
$( css_class ).parent().find( 'input' ).focus().select();
$( css_class ).parent().find( 'input' ).trigger( 'focus' ).trigger( 'select' );
$( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed );
} else {
$( '#copy-error' ).text( '' );
@ -69,10 +69,10 @@
'fadeIn': 50,
'fadeOut': 50,
'delay': 0
} ).focus();
} ).trigger( 'focus' );
} )
.on( 'aftercopyerror', css_class, function() {
$( css_class ).parent().find( 'input' ).focus().select();
$( css_class ).parent().find( 'input' ).trigger( 'focus' ).trigger( 'select' );
$( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed );
} );
},

View File

@ -72,7 +72,7 @@
_.bindAll( this, 'render' );
this.render();
$( window ).resize(function() {
$( window ).on( 'resize', function() {
view.resizeContent();
});
},
@ -88,7 +88,7 @@
}).append( this.$el );
this.resizeContent();
this.$( '.wc-backbone-modal-content' ).attr( 'tabindex' , '0' ).focus();
this.$( '.wc-backbone-modal-content' ).attr( 'tabindex' , '0' ).trigger( 'focus' );
$( document.body ).trigger( 'init_tooltips' );

View File

@ -61,7 +61,7 @@ jQuery(function( $ ) {
);
}
$result = woocommerce_admin_meta_boxes_coupon.prefix + $result + woocommerce_admin_meta_boxes_coupon.suffix;
$coupon_code_field.focus().val( $result );
$coupon_code_field.trigger( 'focus' ).val( $result );
$coupon_code_label.addClass( 'screen-reader-text' );
}
};

View File

@ -22,7 +22,7 @@ jQuery( function ( $ ) {
this.states = JSON.parse( woocommerce_admin_meta_boxes_order.countries.replace( /"/g, '"' ) );
}
$( '.js_field-country' ).selectWoo().change( this.change_country );
$( '.js_field-country' ).selectWoo().on( 'change', this.change_country );
$( '.js_field-country' ).trigger( 'change', [ true ] );
$( document.body ).on( 'change', 'select.js_field-state', this.change_state );
$( '#woocommerce-order-actions input, #woocommerce-order-actions a' ).on( 'click', function() {
@ -140,7 +140,7 @@ jQuery( function ( $ ) {
is_billing = Boolean( $edit_address.find( 'input[name^="_billing_"]' ).length );
$address.hide();
$this.parent().find( 'a' ).toggle();
$this.parent().find( 'a' ).trigger( 'toggle' );
if ( ! $country_input.val() ) {
$country_input.val( woocommerce_admin_meta_boxes_order.default_country ).trigger( 'change' );
@ -1470,7 +1470,7 @@ jQuery( function ( $ ) {
'fadeIn': 50,
'fadeOut': 50,
'delay': 0
}).focus();
}).trigger( 'focus' );
},
/**
@ -1483,7 +1483,7 @@ jQuery( function ( $ ) {
'fadeIn': 50,
'fadeOut': 50,
'delay': 0
}).focus();
}).trigger( 'focus' );
}
};

View File

@ -594,7 +594,7 @@ jQuery( function( $ ) {
$( '.woocommerce-notice-invalid-variation' ).remove();
$( '#variable_product_options' ).find( '.woocommerce_variations' ).prepend( variation );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false );
$( '#variable_product_options' ).trigger( 'woocommerce_variations_added', 1 );
wc_meta_boxes_product_variations_ajax.unblock();
});
@ -700,7 +700,7 @@ jQuery( function( $ ) {
.closest( '.woocommerce_variation' )
.addClass( 'variation-needs-update' );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false );
$( '#variable_product_options' ).trigger( 'woocommerce_variations_input_changed' );
},
@ -714,7 +714,7 @@ jQuery( function( $ ) {
.find( '.woocommerce_variation:first' )
.addClass( 'variation-needs-update' );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false );
$( '#variable_product_options' ).trigger( 'woocommerce_variations_defaults_changed' );
},

View File

@ -34,17 +34,23 @@ jQuery( function( $ ) {
}
$( function() {
// Prevent inputs in meta box headings opening/closing contents.
$( '#woocommerce-product-data' ).find( '.hndle' ).unbind( 'click.postboxes' );
var woocommerce_product_data = $( '#woocommerce-product-data' );
$( '#woocommerce-product-data' ).on( 'click', '.hndle', function( event ) {
// Prevent inputs in meta box headings opening/closing contents.
woocommerce_product_data.find( '.hndle' ).off( 'click.postboxes' );
woocommerce_product_data.on( 'click', '.hndle', function( event ) {
// If the user clicks on some form input inside the h3 the box should not be toggled.
if ( $( event.target ).filter( 'input, option, label, select' ).length ) {
return;
}
$( '#woocommerce-product-data' ).toggleClass( 'closed' );
if ( woocommerce_product_data.hasClass( 'closed' ) ) {
woocommerce_product_data.removeClass( 'closed' );
} else {
woocommerce_product_data.addClass( 'closed' );
}
});
});
@ -77,7 +83,7 @@ jQuery( function( $ ) {
var current_visibility = $( '#current_visibility' ).val();
var current_featured = $( '#current_featured' ).val();
$( 'input[name=_visibility]' ).removeAttr( 'checked' );
$( 'input[name=_visibility]' ).prop( 'checked', false );
$( 'input[name=_visibility][value=' + current_visibility + ']' ).attr( 'checked', 'checked' );
var label = $( 'input[name=_visibility]:checked' ).attr( 'data-label' );
@ -86,7 +92,7 @@ jQuery( function( $ ) {
label = label + ', ' + woocommerce_admin_meta_boxes.featured_label;
$( 'input[name=_featured]' ).attr( 'checked', 'checked' );
} else {
$( 'input[name=_featured]' ).removeAttr( 'checked' );
$( 'input[name=_featured]' ).prop( 'checked', false );
}
$( '#catalog-visibility-display' ).text( label );
@ -94,7 +100,7 @@ jQuery( function( $ ) {
});
// Product type specific options.
$( 'select#product-type' ).change( function() {
$( 'select#product-type' ).on( 'change', function() {
// Get value.
var select_val = $( this ).val();
@ -102,13 +108,13 @@ jQuery( function( $ ) {
if ( 'variable' === select_val ) {
$( 'input#_manage_stock' ).trigger( 'change' );
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
$( 'input#_virtual' ).prop( 'checked', false );
} else if ( 'grouped' === select_val ) {
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
$( 'input#_virtual' ).prop( 'checked', false );
} else if ( 'external' === select_val ) {
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
$( 'input#_virtual' ).prop( 'checked', false );
}
show_and_hide_panels();
@ -119,7 +125,7 @@ jQuery( function( $ ) {
}).trigger( 'change' );
$( 'input#_downloadable, input#_virtual' ).change( function() {
$( 'input#_downloadable, input#_virtual' ).on( 'change', function() {
show_and_hide_panels();
});
@ -239,7 +245,7 @@ jQuery( function( $ ) {
});
// Stock options.
$( 'input#_manage_stock' ).change( function() {
$( 'input#_manage_stock' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) {
$( 'div.stock_fields' ).show();
$( 'p.stock_status_field' ).hide();
@ -361,7 +367,7 @@ jQuery( function( $ ) {
});
$( '.product_attributes' ).on( 'click', 'button.select_no_attributes', function() {
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' );
$( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', false );
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
return false;
});
@ -373,7 +379,7 @@ jQuery( function( $ ) {
if ( $parent.is( '.taxonomy' ) ) {
$parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide();
$( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).removeAttr( 'disabled' );
$( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).prop( 'disabled', false );
} else {
$parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide();

View File

@ -17,7 +17,19 @@ jQuery( function ( $ ) {
runTipTip();
$( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox > h3', function() {
$( this ).parent( '.wc-metabox' ).toggleClass( 'closed' ).toggleClass( 'open' );
var metabox = $( this ).parent( '.wc-metabox' );
if ( metabox.hasClass( 'closed' ) ) {
metabox.removeClass( 'closed' );
} else {
metabox.addClass( 'closed' );
}
if ( metabox.hasClass( 'open' ) ) {
metabox.removeClass( 'open' );
} else {
metabox.addClass( 'open' );
}
});
// Tabbed Panels

View File

@ -57,7 +57,7 @@ jQuery(
'select[name="_visibility"] option, ' +
'select[name="_stock_status"] option, ' +
'select[name="_backorders"] option'
).removeAttr( 'selected' );
).prop( 'selected', false );
var is_variable_product = 'variable' === product_type;
$( 'select[name="_stock_status"] ~ .wc-quick-edit-warning', '.inline-edit-row' ).toggle( is_variable_product );
@ -72,7 +72,7 @@ jQuery(
if ( 'yes' === featured ) {
$( 'input[name="_featured"]', '.inline-edit-row' ).attr( 'checked', 'checked' );
} else {
$( 'input[name="_featured"]', '.inline-edit-row' ).removeAttr( 'checked' );
$( 'input[name="_featured"]', '.inline-edit-row' ).prop( 'checked', false );
}
// Conditional display.

View File

@ -167,7 +167,7 @@
// Postcode and city don't have `name` values by default.
// They're only created if the contents changes, to save on database queries (I think)
this.$el.find( 'td.postcode input, td.city input' ).change( function() {
this.$el.find( 'td.postcode input, td.city input' ).on( 'change', function() {
$( this ).attr( 'name', $( this ).data( 'name' ) );
});

View File

@ -2,7 +2,7 @@
( function( $, params, wp ) {
$( function() {
// Sell Countries
$( 'select#woocommerce_allowed_countries' ).change( function() {
$( 'select#woocommerce_allowed_countries' ).on( 'change', function() {
if ( 'specific' === $( this ).val() ) {
$( this ).closest('tr').next( 'tr' ).hide();
$( this ).closest('tr').next().next( 'tr' ).show();
@ -16,7 +16,7 @@
}).trigger( 'change' );
// Ship Countries
$( 'select#woocommerce_ship_to_countries' ).change( function() {
$( 'select#woocommerce_ship_to_countries' ).on( 'change', function() {
if ( 'specific' === $( this ).val() ) {
$( this ).closest('tr').next( 'tr' ).show();
} else {
@ -25,7 +25,7 @@
}).trigger( 'change' );
// Stock management
$( 'input#woocommerce_manage_stock' ).change( function() {
$( 'input#woocommerce_manage_stock' ).on( 'change', function() {
if ( $( this ).is(':checked') ) {
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show();
} else {
@ -48,15 +48,15 @@
event.stopPropagation();
$( '.iris-picker' ).hide();
$( this ).closest( 'td' ).find( '.iris-picker' ).show();
$( this ).data( 'original-value', $( this ).val() );
$( this ).data( 'originalValue', $( this ).val() );
})
.on( 'change', function() {
if ( $( this ).is( '.iris-error' ) ) {
var original_value = $( this ).data( 'original-value' );
var original_value = $( this ).data( 'originalValue' );
if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) {
$( this ).val( $( this ).data( 'original-value' ) ).trigger( 'change' );
$( this ).val( $( this ).data( 'originalValue' ) ).trigger( 'change' );
} else {
$( this ).val( '' ).trigger( 'change' );
}
@ -71,7 +71,7 @@
$( function() {
var changed = false;
$( 'input, textarea, select, checkbox' ).change( function() {
$( 'input, textarea, select, checkbox' ).on( 'change', function() {
if ( ! changed ) {
window.onbeforeunload = function() {
return params.i18n_nav_warning;
@ -110,13 +110,13 @@
// Select all/none
$( '.woocommerce' ).on( 'click', '.select_all', function() {
$( this ).closest( 'td' ).find( 'select option' ).attr( 'selected', 'selected' );
$( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', true );
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
return false;
});
$( '.woocommerce' ).on( 'click', '.select_none', function() {
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' );
$( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', false );
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
return false;
});
@ -126,7 +126,7 @@
var moveBtn = $( this ),
$row = moveBtn.closest( 'tr' );
moveBtn.focus();
moveBtn.trigger( 'focus' );
var isMoveUp = moveBtn.is( '.wc-move-up' ),
isMoveDown = moveBtn.is( '.wc-move-down' );
@ -147,7 +147,7 @@
}
}
moveBtn.focus(); // Re-focus after the container was moved.
moveBtn.trigger( 'focus' ); // Re-focus after the container was moved.
moveBtn.closest( 'table' ).trigger( 'updateMoveButtons' );
} );

View File

@ -33,11 +33,11 @@ jQuery( function ( $ ) {
$( '.wc_status_table thead, .wc_status_table tbody' ).each( function() {
if ( $( this ).is( 'thead' ) ) {
var label = $( this ).find( 'th:eq(0)' ).data( 'export-label' ) || $( this ).text();
var label = $( this ).find( 'th:eq(0)' ).data( 'exportLabel' ) || $( this ).text();
report = report + '\n### ' + label.trim() + ' ###\n\n';
} else {
$( 'tr', $( this ) ).each( function() {
var label = $( this ).find( 'td:eq(0)' ).data( 'export-label' ) || $( this ).find( 'td:eq(0)' ).text();
var label = $( this ).find( 'td:eq(0)' ).data( 'exportLabel' ) || $( this ).find( 'td:eq(0)' ).text();
var the_name = label.trim().replace( /(<([^>]+)>)/ig, '' ); // Remove HTML.
// Find value
@ -68,7 +68,7 @@ jQuery( function ( $ ) {
try {
$( '#debug-report' ).slideDown();
$( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).focus().select();
$( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).trigger( 'focus' ).trigger( 'select' );
$( this ).fadeOut();
return false;
} catch ( e ) {
@ -100,7 +100,7 @@ jQuery( function ( $ ) {
'fadeIn': 50,
'fadeOut': 50,
'delay': 0
}).focus();
}).trigger( 'focus' );
},
/**
@ -108,7 +108,7 @@ jQuery( function ( $ ) {
*/
copyFail: function() {
$( '.copy-error' ).removeClass( 'hidden' );
$( '#debug-report' ).find( 'textarea' ).focus().select();
$( '#debug-report' ).find( 'textarea' ).trigger( 'focus' ).trigger( 'select' );
}
};

View File

@ -12,7 +12,7 @@ jQuery( function ( $ ) {
this.states = JSON.parse( wc_users_params.countries.replace( /&quot;/g, '"' ) );
}
$( '.js_field-country' ).selectWoo().change( this.change_country );
$( '.js_field-country' ).selectWoo().on( 'change', this.change_country );
$( '.js_field-country' ).trigger( 'change', [ true ] );
$( document.body ).on( 'change', 'select.js_field-state', this.change_state );

View File

@ -17,7 +17,7 @@ function wcSetClipboard( data, $el ) {
}
var $temp_input = jQuery( '<textarea style="opacity:0">' );
jQuery( 'body' ).append( $temp_input );
$temp_input.val( data ).select();
$temp_input.val( data ).trigger( 'select' );
$el.trigger( 'beforecopy' );
try {

View File

@ -45,12 +45,12 @@ jQuery( function( $ ) {
*/
WCOrdersTable.prototype.onPreview = function() {
var $previewButton = $( this ),
$order_id = $previewButton.data( 'order-id' );
$order_id = $previewButton.data( 'orderId' );
if ( $previewButton.data( 'order-data' ) ) {
$( this ).WCBackboneModal({
template: 'wc-modal-view-order',
variable : $previewButton.data( 'order-data' )
variable : $previewButton.data( 'orderData' )
});
} else {
$previewButton.addClass( 'disabled' );
@ -67,7 +67,7 @@ jQuery( function( $ ) {
$( '.order-preview' ).removeClass( 'disabled' );
if ( response.success ) {
$previewButton.data( 'order-data', response.data );
$previewButton.data( 'orderData', response.data );
$( this ).WCBackboneModal({
template: 'wc-modal-view-order',

View File

@ -37,7 +37,7 @@ jQuery( function( $ ) {
} );
$( document.body ).on( 'wc_backbone_modal_response', function() {
form.unbind( 'submit' ).trigger( 'submit' );
form.off( 'submit' ).trigger( 'submit' );
} );
$( '#wc_tracker_checkbox_dialog' ).on( 'change', function( e ) {
@ -46,7 +46,7 @@ jQuery( function( $ ) {
} );
$( '#wc_tracker_submit' ).on( 'click', function () {
form.unbind( 'submit' ).trigger( 'submit' );
form.off( 'submit' ).trigger( 'submit' );
} );
return true;
@ -96,7 +96,7 @@ jQuery( function( $ ) {
if ( $.isEmptyObject( country_postcode_obj ) || country_postcode_obj.required ) {
$store_postcode_input.attr( 'required', 'true' );
} else {
$store_postcode_input.removeAttr( 'required' );
$store_postcode_input.prop( 'required', false );
}
} );
@ -139,7 +139,14 @@ jQuery( function( $ ) {
} );
$( '.wc-wizard-services-list-toggle' ).on( 'click', function() {
$( this ).closest( '.wc-wizard-services-list-toggle' ).toggleClass( 'closed' );
var listToggle = $( this ).closest( '.wc-wizard-services-list-toggle' );
if ( listToggle.hasClass( 'closed' ) ) {
listToggle.removeClass( 'closed' );
} else {
listToggle.addClass( 'closed' );
}
$( this ).closest( '.wc-wizard-services' ).find( '.wc-wizard-service-item' )
.slideToggle()
.css( 'display', 'flex' );

View File

@ -202,7 +202,7 @@
},
setUnloadConfirmation: function() {
this.needsUnloadConfirm = true;
$save_button.removeAttr( 'disabled' );
$save_button.prop( 'disabled', false );
},
clearUnloadConfirmation: function() {
this.needsUnloadConfirm = false;

View File

@ -221,7 +221,7 @@
},
setUnloadConfirmation: function() {
this.needsUnloadConfirm = true;
$save_button.removeAttr( 'disabled' );
$save_button.prop( 'disabled', false );
},
clearUnloadConfirmation: function() {
this.needsUnloadConfirm = false;

View File

@ -232,7 +232,7 @@
});
// Focus on inputs within the table if clicked instead of trying to sort.
$( '.wc_input_table.sortable tbody input' ).on( 'click', function() {
$( this ).focus();
$( this ).trigger( 'focus' );
} );
$( '.wc_input_table .remove_rows' ).on( 'click', function() {
@ -309,7 +309,7 @@
});
// Select availability
$( 'select.availability' ).change( function() {
$( 'select.availability' ).on( 'change', function() {
if ( $( this ).val() === 'all' ) {
$( this ).closest( 'tr' ).next( 'tr' ).hide();
} else {
@ -319,7 +319,7 @@
// Hidden options
$( '.hide_options_if_checked' ).each( function() {
$( this ).find( 'input:eq(0)' ).change( function() {
$( this ).find( 'input:eq(0)' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) {
$( this )
.closest( 'fieldset, tr' )
@ -335,7 +335,7 @@
});
$( '.show_options_if_checked' ).each( function() {
$( this ).find( 'input:eq(0)' ).change( function() {
$( this ).find( 'input:eq(0)' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) {
$( this )
.closest( 'fieldset, tr' )
@ -351,7 +351,7 @@
});
// Reviews.
$( 'input#woocommerce_enable_reviews' ).change(function() {
$( 'input#woocommerce_enable_reviews' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) {
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).show();
} else {

View File

@ -104,7 +104,7 @@
// KEYBOARD:
if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
$(document).bind('keyup', function(event) {
$(document).on('keyup', function(event) {
var keycode = event.keyCode;
if (!slider.animating && (keycode === 39 || keycode === 37)) {
var target = (slider.vars.rtl?
@ -121,7 +121,7 @@
}
// MOUSEWHEEL:
if (slider.vars.mousewheel) {
slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
slider.on('mousewheel', function(event, delta, deltaX, deltaY) {
event.preventDefault();
var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
slider.flexAnimate(target, slider.vars.pauseOnAction);
@ -137,9 +137,9 @@
// SLIDSESHOW
if (slider.vars.slideshow) {
if (slider.vars.pauseOnHover) {
slider.hover(function() {
slider.on( 'mouseenter', function() {
if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }
}, function() {
} ).on( 'mouseleave', function() {
if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }
});
}
@ -157,7 +157,7 @@
if (touch && slider.vars.touch) { methods.touch(); }
// FADE&&SMOOTHHEIGHT || SLIDE:
if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange focus", methods.resize); }
if (!fade || (fade && slider.vars.smoothHeight)) { $(window).on("resize orientationchange focus", methods.resize); }
slider.find("img").attr("draggable", "false");
@ -274,7 +274,7 @@
methods.controlNav.active();
slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
slider.controlNavScaffold.on(eventType, 'a, img', function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
@ -299,7 +299,7 @@
slider.controlNav = slider.manualControls;
methods.controlNav.active();
slider.controlNav.bind(eventType, function(event) {
slider.controlNav.on(eventType, function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
@ -356,7 +356,7 @@
methods.directionNav.update();
slider.directionNav.bind(eventType, function(event) {
slider.directionNav.on(eventType, function(event) {
event.preventDefault();
var target;
@ -372,7 +372,7 @@
methods.setToClearWatchedEvent();
});
},
update: function() {
update: function() {console.log('updating...');
var disabledClass = namespace + 'disabled';
if (slider.pagingCount === 1) {
slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
@ -382,10 +382,10 @@
} else if (slider.animatingTo === slider.last) {
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
} else {
slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
slider.directionNav.removeClass(disabledClass).prop( 'tabindex', '-1' );
}
} else {
slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
slider.directionNav.removeClass(disabledClass).prop( 'tabindex', '-1' );
}
}
},
@ -404,7 +404,7 @@
methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
slider.pausePlay.bind(eventType, function(event) {
slider.pausePlay.on(eventType, function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
@ -794,8 +794,8 @@
}
// Unbind previous transitionEnd events and re-bind new transitionEnd event
slider.container.unbind("webkitTransitionEnd transitionend");
slider.container.bind("webkitTransitionEnd transitionend", function() {
slider.container.off("webkitTransitionEnd transitionend");
slider.container.on("webkitTransitionEnd transitionend", function() {
clearTimeout(slider.ensureAnimationEnd);
slider.wrapup(dimension);
});
@ -1133,9 +1133,9 @@
};
// Ensure the slider isn't focussed if the window loses focus.
$( window ).blur( function ( e ) {
$( window ).on( 'blur', function ( e ) {
focused = false;
}).focus( function ( e ) {
}).on( 'focus', function ( e ) {
focused = true;
});

View File

@ -26,7 +26,7 @@ jQuery( function( $ ) {
// Trigger initial click
.find( 'input[name=payment_method]:checked' ).trigger( 'click' );
$( '#add_payment_method' ).submit( function() {
$( '#add_payment_method' ).on( 'submit', function() {
$( '#add_payment_method' ).block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
});

View File

@ -379,7 +379,7 @@
if ( ! current_attr_select.data( 'attribute_html' ) ) {
var refSelect = current_attr_select.clone();
refSelect.find( 'option' ).prop( 'disabled attached', false ).prop( 'selected', false );
refSelect.find( 'option' ).removeAttr( 'attached' ).prop( 'disabled', false ).prop( 'selected', false );
// Legacy data attribute.
current_attr_select.data(

View File

@ -58,7 +58,7 @@ jQuery( function( $ ) {
$( document.body ).trigger( 'init_checkout' );
}
if ( wc_checkout_params.option_guest_checkout === 'yes' ) {
$( 'input#createaccount' ).change( this.toggle_create_account ).trigger( 'change' );
$( 'input#createaccount' ).on( 'change', this.toggle_create_account ).trigger( 'change' );
}
},
init_payment_methods: function() {
@ -449,12 +449,12 @@ jQuery( function( $ ) {
$( window ).on('beforeunload', this.handleUnloadEvent);
},
detachUnloadEventsOnSubmit: function() {
$( window ).unbind('beforeunload', this.handleUnloadEvent);
$( window ).off('beforeunload', this.handleUnloadEvent);
},
blockOnSubmit: function( $form ) {
var form_data = $form.data();
var isBlocked = $form.data( 'blockUI.isBlocked' );
if ( 1 !== form_data['blockUI.isBlocked'] ) {
if ( 1 !== isBlocked ) {
$form.block({
message: null,
overlayCSS: {
@ -589,11 +589,11 @@ jQuery( function( $ ) {
init: function() {
$( document.body ).on( 'click', 'a.showcoupon', this.show_coupon_form );
$( document.body ).on( 'click', '.woocommerce-remove-coupon', this.remove_coupon );
$( 'form.checkout_coupon' ).hide().submit( this.submit );
$( 'form.checkout_coupon' ).hide().on( 'submit', this.submit );
},
show_coupon_form: function() {
$( '.checkout_coupon' ).slideToggle( 400, function() {
$( '.checkout_coupon' ).find( ':input:eq(0)' ).focus();
$( '.checkout_coupon' ).find( ':input:eq(0)' ).trigger( 'focus' );
});
return false;
},

View File

@ -65,7 +65,7 @@ jQuery( function( $ ) {
$( this )
.on( 'select2:select', function() {
$( this ).focus(); // Maintain focus after select https://github.com/select2/select2/issues/4384
$( this ).trigger( 'focus' ); // Maintain focus after select https://github.com/select2/select2/issues/4384
} )
.selectWoo( select2_args );
});

View File

@ -48,7 +48,7 @@
) {
submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' );
} else {
submit.removeAttr( 'disabled', 'disabled' ).removeClass( 'disabled' );
submit.prop( 'disabled', false ).removeClass( 'disabled' );
}
},

View File

@ -30,7 +30,7 @@ jQuery( function( $ ) {
);
// OR if create account is checked.
$( 'input#createaccount' ).change( { tokenizationForm: this }, this.onCreateAccountChange );
$( 'input#createaccount' ).on( 'change', { tokenizationForm: this }, this.onCreateAccountChange );
// First display.
this.onDisplay();

View File

@ -14,7 +14,7 @@ jQuery( function( $ ) {
}
});
var noticeID = $( '.woocommerce-store-notice' ).data( 'notice-id' ) || '',
var noticeID = $( '.woocommerce-store-notice' ).data( 'noticeId' ) || '',
cookieName = 'store_notice' + noticeID;
// Check the value of that cookie and show/hide the notice accordingly
@ -87,7 +87,11 @@ jQuery( function( $ ) {
$( '.show-password-input' ).on( 'click',
function() {
$( this ).toggleClass( 'display-password' );
if ( $( this ).hasClass( 'display-password' ) ) {
$( this ).removeClass( 'display-password' );
} else {
$( this ).addClass( 'display-password' );
}
if ( $( this ).hasClass( 'display-password' ) ) {
$( this ).siblings( ['input[type="password"]'] ).prop( 'type', 'text' );
} else {

View File

@ -25,7 +25,7 @@
var msie = /MSIE/.test(navigator.userAgent);
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
var mode = document.documentMode || 0;
var setExpr = $.isFunction( document.createElement('div').style.setExpression );
var setExpr = 'function' === typeof document.createElement('div').style.setExpression ? document.createElement('div').style.setExpression : false;
// global $ methods for blocking/unblocking the entire page
$.blockUI = function(opts) { install(window, opts); };
@ -56,7 +56,7 @@
callBlock();
var nonmousedOpacity = $m.css('opacity');
$m.mouseover(function() {
$m.on( 'mouseover', function() {
callBlock({
fadeIn: 0,
timeout: 30000
@ -65,7 +65,7 @@
var displayBlock = $('.blockMsg');
displayBlock.stop(); // cancel fadeout if it has started
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
}).mouseout(function() {
}).on( 'mouseout', function() {
$('.blockMsg').fadeOut(1000);
});
// End konapun additions
@ -550,9 +550,9 @@
// bind anchors and inputs for mouse and key events
var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
if (b)
$(document).bind(events, opts, handler);
$(document).on(events, opts, handler);
else
$(document).unbind(events, handler);
$(document).off(events, handler);
// former impl...
// var $e = $('a,:input');
@ -591,7 +591,7 @@
return;
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
if (e)
e.focus();
e.trigger( 'focus' );
}
function center(el, x, y) {

View File

@ -49,14 +49,14 @@
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
return 'function' === typeof converter ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (value !== undefined && !$.isFunction(value)) {
if (value !== undefined && 'function' !== typeof value) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {

View File

@ -29,7 +29,7 @@ Licensed under the MIT license.
* V. 1.1: Fix error handling so e.g. parsing an empty string does
* produce a color rather than just crashing.
*/
(function(B){B.color={};B.color.make=function(F,E,C,D){var G={};G.r=F||0;G.g=E||0;G.b=C||0;G.a=D!=null?D:1;G.add=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]+=I}return G.normalize()};G.scale=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]*=I}return G.normalize()};G.toString=function(){if(G.a>=1){return"rgb("+[G.r,G.g,G.b].join(",")+")"}else{return"rgba("+[G.r,G.g,G.b,G.a].join(",")+")"}};G.normalize=function(){function H(J,K,I){return K<J?J:(K>I?I:K)}G.r=H(0,parseInt(G.r),255);G.g=H(0,parseInt(G.g),255);G.b=H(0,parseInt(G.b),255);G.a=H(0,G.a,1);return G};G.clone=function(){return B.color.make(G.r,G.b,G.g,G.a)};return G.normalize()};B.color.extract=function(D,C){var E;do{E=D.css(C).toLowerCase();if(E!=""&&E!="transparent"){break}D=D.parent()}while(!B.nodeName(D.get(0),"body"));if(E=="rgba(0, 0, 0, 0)"){E="transparent"}return B.color.parse(E)};B.color.parse=function(F){var E,C=B.color.make;if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10))}if(E=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10),parseFloat(E[4]))}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55)}if(E=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55,parseFloat(E[4]))}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return C(parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16))}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return C(parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16))}var D=B.trim(F).toLowerCase();if(D=="transparent"){return C(255,255,255,0)}else{E=A[D]||[0,0,0];return C(E[0],E[1],E[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
(function(B){B.color={};B.color.make=function(F,E,C,D){var G={};G.r=F||0;G.g=E||0;G.b=C||0;G.a=D!=null?D:1;G.add=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]+=I}return G.normalize()};G.scale=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]*=I}return G.normalize()};G.toString=function(){if(G.a>=1){return"rgb("+[G.r,G.g,G.b].join(",")+")"}else{return"rgba("+[G.r,G.g,G.b,G.a].join(",")+")"}};G.normalize=function(){function H(J,K,I){return K<J?J:(K>I?I:K)}G.r=H(0,parseInt(G.r),255);G.g=H(0,parseInt(G.g),255);G.b=H(0,parseInt(G.b),255);G.a=H(0,G.a,1);return G};G.clone=function(){return B.color.make(G.r,G.b,G.g,G.a)};return G.normalize()};B.color.extract=function(D,C){var E;do{E=D.css(C).toLowerCase();if(E!=""&&E!="transparent"){break}D=D.parent()}while(!B.nodeName(D.get(0),"body"));if(E=="rgba(0, 0, 0, 0)"){E="transparent"}return B.color.parse(E)};B.color.parse=function(F){var E,C=B.color.make;if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10))}if(E=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10),parseFloat(E[4]))}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55)}if(E=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55,parseFloat(E[4]))}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return C(parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16))}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return C(parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16))}if('string'===typeof F){var D=F.trim().toLowerCase()}else{var D=''};if(D=="transparent"){return C(255,255,255,0)}else{E=A[D]||[0,0,0];return C(E[0],E[1],E[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
// the actual Flot code
(function($) {
@ -1265,7 +1265,7 @@ Licensed under the MIT license.
octx = overlay.context;
// define which element we're listening for events on
eventHolder = $(overlay.element).unbind();
eventHolder = $(overlay.element).off();
// If we're re-using a plot object, shut down the old one
@ -1291,11 +1291,11 @@ Licensed under the MIT license.
// was fixed somewhere around 1.3.x. We can return to using
// .mouseleave when we drop support for 1.2.6.
eventHolder.bind("mouseleave", onMouseLeave);
eventHolder.on("mouseleave", onMouseLeave);
}
if (options.grid.clickable)
eventHolder.click(onClick);
eventHolder.on( 'click', onClick );
executeHooks(hooks.bindEvents, [eventHolder]);
}
@ -1304,9 +1304,9 @@ Licensed under the MIT license.
if (redrawTimeout)
clearTimeout(redrawTimeout);
eventHolder.unbind("mousemove", onMouseMove);
eventHolder.unbind("mouseleave", onMouseLeave);
eventHolder.unbind("click", onClick);
eventHolder.off("mousemove", onMouseMove);
eventHolder.off("mouseleave", onMouseLeave);
eventHolder.off("click", onClick);
executeHooks(hooks.shutdown, [eventHolder]);
}
@ -1704,7 +1704,7 @@ Licensed under the MIT license.
};
}
if ($.isFunction(opts.tickFormatter))
if ( 'function' === typeof opts.tickFormatter )
axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); };
if (opts.alignTicksWithAxis != null) {
@ -1751,7 +1751,7 @@ Licensed under the MIT license.
if (oticks == null || (typeof oticks == "number" && oticks > 0))
ticks = axis.tickGenerator(axis);
else if (oticks) {
if ($.isFunction(oticks))
if ( 'function' === typeof oticks )
// generate the ticks
ticks = oticks(axis);
else
@ -1875,7 +1875,7 @@ Licensed under the MIT license.
// draw markings
var markings = options.grid.markings;
if (markings) {
if ($.isFunction(markings)) {
if ( 'function' === typeof markings ) {
axes = plot.getAxes();
// xmin etc. is backwards compatibility, to be
// removed in the future
@ -2659,7 +2659,7 @@ Licensed under the MIT license.
// Sort the legend using either the default or a custom comparator
if (options.legend.sorted) {
if ($.isFunction(options.legend.sorted)) {
if ( 'function' === typeof options.legend.sorted ) {
entries.sort(options.legend.sorted);
} else if (options.legend.sorted == "reverse") {
entries.reverse();

View File

@ -120,10 +120,10 @@ More detail and specific examples can be found in the included HTML file.
var options = plot.getOptions();
if (options.series.pie.show) {
if (options.grid.hoverable) {
eventHolder.unbind("mousemove").mousemove(onMouseMove);
eventHolder.off("mousemove").on( 'mousemove', onMouseMove );
}
if (options.grid.clickable) {
eventHolder.unbind("click").click(onClick);
eventHolder.off("click").on( 'click', onClick );
}
}
});
@ -180,11 +180,11 @@ More detail and specific examples can be found in the included HTML file.
// new one; this is more efficient and preserves any extra data
// that the user may have stored in higher indexes.
if ($.isArray(value) && value.length == 1) {
if (Array.isArray(value) && value.length == 1) {
value = value[0];
}
if ($.isArray(value)) {
if (Array.isArray(value)) {
// Equivalent to $.isNumeric() but compatible with jQuery < 1.7
if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
value[1] = +value[1];

View File

@ -20,7 +20,7 @@ can just fix the size of their placeholders.
* http://benalman.com/about/license/
*/
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if('function'===typeof l){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
(function ($) {
var options = { }; // no options
@ -40,11 +40,11 @@ can just fix the size of their placeholders.
}
function bindEvents(plot, eventHolder) {
plot.getPlaceholder().resize(onResize);
plot.getPlaceholder().on( 'resize', onResize );
}
function shutdown(plot, eventHolder) {
plot.getPlaceholder().unbind("resize", onResize);
plot.getPlaceholder().off("resize", onResize);
}
plot.hooks.bindEvents.push(bindEvents);

View File

@ -554,8 +554,8 @@ jQuery( function( $ ) {
if (!(month && year)) {
return false;
}
month = $.trim(month);
year = $.trim(year);
month = 'string' === typeof month ? month.trim() : '';
year = 'string' === typeof year ? year.trim() : '';
if (!/^\d+$/.test(month)) {
return false;
}
@ -584,7 +584,7 @@ jQuery( function( $ ) {
$.payment.validateCardCVC = function(cvc, type) {
var card, _ref;
cvc = $.trim(cvc);
cvc = 'string' === typeof cvc ? cvc.trim() : '';
if (!/^\d+$/.test(cvc)) {
return false;
}

View File

@ -131,7 +131,7 @@
if (opts.typeFunctions && type && opts.typeFunctions[type]) { // use a type if available
parsedVal = opts.typeFunctions[type](valStr);
} else if (opts.parseNumbers && f.isNumeric(valStr)) { // auto: number
} else if (opts.parseNumbers && (! isNaN(valStr) && isFinite(valStr))) { // auto: number
parsedVal = Number(valStr);
} else if (opts.parseBooleans && (valStr === "true" || valStr === "false")) { // auto: boolean
parsedVal = (valStr === "true");
@ -314,12 +314,12 @@
// '' is used to push values into the array "array[]"
if (nextKey === '') {
if (f.isUndefined(o[key]) || !$.isArray(o[key])) {
if (f.isUndefined(o[key]) || !Array.isArray(o[key])) {
o[key] = []; // define (or override) as array to push values
}
} else {
if (opts.useIntKeysAsArrayIndex && f.isValidArrayIndex(nextKey)) { // if 1, 2, 3 ... then use an array, where nextKey is the index
if (f.isUndefined(o[key]) || !$.isArray(o[key])) {
if (f.isUndefined(o[key]) || !Array.isArray(o[key])) {
o[key] = []; // define (or override) as array, to insert values using int keys as array indexes
}
} else { // for anything else, use an object, where nextKey is going to be the attribute name

View File

@ -58,40 +58,40 @@
}
if(org_title != ""){
if(!opts.content){
org_elem.removeAttr(opts.attribute); //remove original Attribute
org_elem.prop(opts.attribute, false); //remove original Attribute
}
var timeout = false;
if(opts.activation == "hover"){
org_elem.hover(function(){
org_elem.on( 'mouseenter', function(){
active_tiptip();
}, function(){
} ).on( 'mouseleave', function(){
if(!opts.keepAlive || !tiptip_holder.is(':hover')){
deactive_tiptip();
}
});
if(opts.keepAlive){
tiptip_holder.hover(function(){}, function(){
tiptip_holder.on( 'mouseenter', function(){} ).on( 'mouseleave', function(){
deactive_tiptip();
});
}
} else if(opts.activation == "focus"){
org_elem.focus(function(){
org_elem.on( 'focus', function(){
active_tiptip();
}).blur(function(){
}).on( 'blur', function(){
deactive_tiptip();
});
} else if(opts.activation == "click"){
org_elem.click(function(){
org_elem.on( 'click', function(){
active_tiptip();
return false;
}).hover(function(){},function(){
}).on( 'mouseenter', function(){} ).on( 'mouseleave' ,function(){
if(!opts.keepAlive){
deactive_tiptip();
}
});
if(opts.keepAlive){
tiptip_holder.hover(function(){}, function(){
tiptip_holder.on( 'mouseenter', function(){} ).on( 'mouseleave', function(){
deactive_tiptip();
});
}
@ -100,7 +100,8 @@
function active_tiptip(){
opts.enter.call(this);
tiptip_content.html(org_title);
tiptip_holder.hide().removeAttr("class").css("margin","0");
tiptip_holder.hide().css("margin","0");
tiptip_holder.removeAttr('class');
tiptip_arrow.removeAttr("style");
var top = parseInt(org_elem.offset()['top']);

View File

@ -149,7 +149,7 @@
var self = this;
// Delegate the touch handlers to the widget's element
self.element.bind({
self.element.on({
touchstart: $.proxy(self, '_touchStart'),
touchmove: $.proxy(self, '_touchMove'),
touchend: $.proxy(self, '_touchEnd')
@ -167,7 +167,7 @@
var self = this;
// Delegate the touch handlers to the widget's element
self.element.unbind({
self.element.off({
touchstart: $.proxy(self, '_touchStart'),
touchmove: $.proxy(self, '_touchMove'),
touchend: $.proxy(self, '_touchEnd')

View File

@ -108,10 +108,10 @@
doresize = true, scroll_pos = _get_scroll();
// Window/Keyboard events
$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
$(window).off('resize.prettyphoto').on('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
if(pp_settings.keyboard_shortcuts) {
$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){
$(document).off('keydown.prettyphoto').on('keydown.prettyphoto',function(e){
if(typeof $pp_pic_holder != 'undefined'){
if($pp_pic_holder.is(':visible')){
switch(e.keyCode){
@ -162,7 +162,7 @@
_build_overlay(this); // Build the overlay {this} being the caller
if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
$(window).on('scroll.prettyphoto',function(){ _center_overlay(); });
$.prettyPhoto.open();
@ -431,7 +431,7 @@
*/
$.prettyPhoto.startSlideshow = function(){
if(typeof pp_slideshow == 'undefined'){
$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
$pp_pic_holder.find('.pp_play').off('click').removeClass('pp_play').addClass('pp_pause').on( 'click', function(){
$.prettyPhoto.stopSlideshow();
return false;
});
@ -446,7 +446,7 @@
* Stop the slideshow...
*/
$.prettyPhoto.stopSlideshow = function(){
$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
$pp_pic_holder.find('.pp_pause').off('click').removeClass('pp_pause').addClass('pp_play').on( 'click', function(){
$.prettyPhoto.startSlideshow();
return false;
});
@ -473,7 +473,7 @@
$(this).remove(); // No more need for the prettyPhoto markup
$(window).unbind('scroll.prettyphoto');
$(window).off('scroll.prettyphoto');
clearHashtag();
@ -739,7 +739,7 @@
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
}else{
$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
$pp_pic_holder.find('.pp_content').off('mouseenter mouseleave');
// $pp_gallery.hide();
}
}
@ -776,22 +776,22 @@
$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
$pp_gallery.find('.pp_arrow_next').click(function(){
$pp_gallery.find('.pp_arrow_next').on( 'click', function(){
$.prettyPhoto.changeGalleryPage('next');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_gallery.find('.pp_arrow_previous').click(function(){
$pp_gallery.find('.pp_arrow_previous').on( 'click', function(){
$.prettyPhoto.changeGalleryPage('previous');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_content').hover(
$pp_pic_holder.find('.pp_content').on( 'mouseenter',
function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
},
} ).on( 'mouseleave',
function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
});
@ -800,7 +800,7 @@
$pp_gallery_li.each(function(i){
$(this)
.find('a')
.click(function(){
.on( 'click', function(){
$.prettyPhoto.changePage(i);
$.prettyPhoto.stopSlideshow();
return false;
@ -812,7 +812,7 @@
// Inject the play/pause if it's a slideshow
if(settings.slideshow){
$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
$pp_pic_holder.find('.pp_nav .pp_play').on( 'click', function(){
$.prettyPhoto.startSlideshow();
return false;
});
@ -826,15 +826,15 @@
'height':$(document).height(),
'width':$(window).width()
})
.bind('click',function(){
.on('click',function(){
if(!settings.modal) $.prettyPhoto.close();
});
$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
$('a.pp_close').on('click',function(){ $.prettyPhoto.close(); return false; });
if(settings.allow_expand) {
$('a.pp_expand').bind('click',function(e){
$('a.pp_expand').on('click',function(e){
// Expand the image
if($(this).hasClass('pp_expand')){
$(this).removeClass('pp_expand').addClass('pp_contract');
@ -850,13 +850,13 @@
});
}
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').on('click',function(){
$.prettyPhoto.changePage('previous');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').on('click',function(){
$.prettyPhoto.changePage('next');
$.prettyPhoto.stopSlideshow();
return false;
@ -879,7 +879,7 @@
setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
}
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
return this.off('click.prettyphoto').on('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
};
function getHashtag(){

View File

@ -1430,7 +1430,7 @@ S2.define('select2/selection/base',[
// This needs to be delayed as the active element is the body when the
// key is pressed.
window.setTimeout(function () {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}, 1);
self._detachCloseHandler(container);
@ -1591,7 +1591,7 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) {
if (!container.isOpen()) {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}
});
@ -2109,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch();
if (searchHadFocus) {
this.$search.focus();
this.$search.trigger( 'focus' );
}
};
@ -3547,7 +3547,7 @@ S2.define('select2/data/ajax',[
if (this._request != null) {
// JSONP requests cannot always be aborted
if ($.isFunction(this._request.abort)) {
if ( typeof this._request.abort === 'function' ) {
this._request.abort();
}
@ -3572,7 +3572,7 @@ S2.define('select2/data/ajax',[
if (self.options.get('debug') && window.console && console.error) {
// Check to make sure that the response included a `results` key.
if (!results || !results.results || !$.isArray(results.results)) {
if (!results || !results.results || ! Array.isArray( results.results ) ) {
console.error(
'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.'
@ -3631,7 +3631,7 @@ S2.define('select2/data/tags',[
decorated.call(this, $element, options);
if ($.isArray(tags)) {
if ( Array.isArray( tags ) ) {
for (var t = 0; t < tags.length; t++) {
var tag = tags[t];
var item = this._normalizeItem(tag);
@ -3707,7 +3707,7 @@ S2.define('select2/data/tags',[
};
Tags.prototype.createTag = function (decorated, params) {
var term = $.trim(params.term);
var term = params.term.trim();
if (term === '') {
return null;
@ -3800,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
this.$search.focus();
this.$search.trigger( 'focus' );
}
params.term = tokenData.term;
@ -4047,10 +4047,10 @@ S2.define('select2/dropdown/search',[
container.on('open', function () {
self.$search.attr('tabindex', 0);
self.$search.attr('aria-owns', resultsId);
self.$search.focus();
self.$search.trigger( 'focus' );
window.setTimeout(function () {
self.$search.focus();
self.$search.trigger( 'focus' );
}, 0);
});
@ -4063,7 +4063,7 @@ S2.define('select2/dropdown/search',[
container.on('focus', function () {
if (!container.isOpen()) {
self.$search.focus();
self.$search.trigger( 'focus' );
}
});
@ -4878,7 +4878,7 @@ S2.define('select2/defaults',[
}
}
if ($.isArray(options.language)) {
if ( Array.isArray( options.language ) ) {
var languages = new Translation();
options.language.push('en');
@ -4941,7 +4941,7 @@ S2.define('select2/defaults',[
function matcher (params, data) {
// Always return the object if there is nothing to compare
if ($.trim(params.term) === '') {
if ( params.term.trim() === '' ) {
return data;
}
@ -5724,7 +5724,7 @@ S2.define('select2/core',[
var newVal = args[0];
if ($.isArray(newVal)) {
if ( Array.isArray( newVal ) ) {
newVal = $.map(newVal, function (obj) {
return obj.toString();
});
@ -5801,7 +5801,7 @@ S2.define('select2/compat/utils',[
function syncCssClasses ($dest, $src, adapter) {
var classes, replacements = [], adapted;
classes = $.trim($dest.attr('class'));
classes = $dest.attr('class').trim();
if (classes) {
classes = '' + classes; // for IE which returns object
@ -5814,7 +5814,7 @@ S2.define('select2/compat/utils',[
});
}
classes = $.trim($src.attr('class'));
classes = $src.attr('class').trim();
if (classes) {
classes = '' + classes; // for IE which returns object
@ -5855,7 +5855,7 @@ S2.define('select2/compat/containerCss',[
var containerCssClass = this.options.get('containerCssClass') || '';
if ($.isFunction(containerCssClass)) {
if ( typeof containerCssClass === 'function' ) {
containerCssClass = containerCssClass(this.$element);
}
@ -5881,7 +5881,7 @@ S2.define('select2/compat/containerCss',[
var containerCss = this.options.get('containerCss') || {};
if ($.isFunction(containerCss)) {
if ( typeof containerCss === 'function' ) {
containerCss = containerCss(this.$element);
}
@ -5912,7 +5912,7 @@ S2.define('select2/compat/dropdownCss',[
var dropdownCssClass = this.options.get('dropdownCssClass') || '';
if ($.isFunction(dropdownCssClass)) {
if ( typeof dropdownCssClass === 'function' ) {
dropdownCssClass = dropdownCssClass(this.$element);
}
@ -5938,7 +5938,7 @@ S2.define('select2/compat/dropdownCss',[
var dropdownCss = this.options.get('dropdownCss') || {};
if ($.isFunction(dropdownCss)) {
if ( typeof dropdownCss === 'function' ) {
dropdownCss = dropdownCss(this.$element);
}
@ -5985,7 +5985,7 @@ S2.define('select2/compat/initSelection',[
this.initSelection.call(null, this.$element, function (data) {
self._isInitialized = true;
if (!$.isArray(data)) {
if ( ! Array.isArray( data ) ) {
data = [data];
}
@ -6131,7 +6131,7 @@ S2.define('select2/compat/matcher',[
function wrappedMatcher (params, data) {
var match = $.extend(true, {}, data);
if (params.term == null || $.trim(params.term) === '') {
if (params.term == null || params.term.trim() === '') {
return match;
}
@ -6374,11 +6374,11 @@ S2.define('select2/selection/stopPropagation',[
$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
return fn ? this.on('mousewheel', fn) : this.trigger('mousewheel');
},
unmousewheel: function(fn) {
return this.unbind('mousewheel', fn);
return this.off('mousewheel', fn);
}
});

View File

@ -1430,7 +1430,7 @@ S2.define('select2/selection/base',[
// This needs to be delayed as the active element is the body when the
// key is pressed.
window.setTimeout(function () {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}, 1);
self._detachCloseHandler(container);
@ -1591,7 +1591,7 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) {
if (!container.isOpen()) {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}
});
@ -2109,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch();
if (searchHadFocus) {
this.$search.focus();
this.$search.trigger( 'focus' );
}
};
@ -3547,7 +3547,7 @@ S2.define('select2/data/ajax',[
if (this._request != null) {
// JSONP requests cannot always be aborted
if ($.isFunction(this._request.abort)) {
if ( typeof this._request.abort === 'function' ) {
this._request.abort();
}
@ -3572,7 +3572,7 @@ S2.define('select2/data/ajax',[
if (self.options.get('debug') && window.console && console.error) {
// Check to make sure that the response included a `results` key.
if (!results || !results.results || !$.isArray(results.results)) {
if (!results || !results.results || ! Array.isArray( results.results ) ) {
console.error(
'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.'
@ -3631,7 +3631,7 @@ S2.define('select2/data/tags',[
decorated.call(this, $element, options);
if ($.isArray(tags)) {
if ( Array.isArray( tags ) ) {
for (var t = 0; t < tags.length; t++) {
var tag = tags[t];
var item = this._normalizeItem(tag);
@ -3707,7 +3707,7 @@ S2.define('select2/data/tags',[
};
Tags.prototype.createTag = function (decorated, params) {
var term = $.trim(params.term);
var term = params.term.trim();
if (term === '') {
return null;
@ -3800,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
this.$search.focus();
this.$search.trigger( 'focus' );
}
params.term = tokenData.term;
@ -4047,10 +4047,10 @@ S2.define('select2/dropdown/search',[
container.on('open', function () {
self.$search.attr('tabindex', 0);
self.$search.attr('aria-owns', resultsId);
self.$search.focus();
self.$search.trigger( 'focus' );
window.setTimeout(function () {
self.$search.focus();
self.$search.trigger( 'focus' );
}, 0);
});
@ -4063,7 +4063,7 @@ S2.define('select2/dropdown/search',[
container.on('focus', function () {
if (!container.isOpen()) {
self.$search.focus();
self.$search.trigger( 'focus' );
}
});
@ -4878,7 +4878,7 @@ S2.define('select2/defaults',[
}
}
if ($.isArray(options.language)) {
if ( Array.isArray( options.language ) ) {
var languages = new Translation();
options.language.push('en');
@ -4941,7 +4941,7 @@ S2.define('select2/defaults',[
function matcher (params, data) {
// Always return the object if there is nothing to compare
if ($.trim(params.term) === '') {
if ( params.term.trim() === '' ) {
return data;
}
@ -5724,7 +5724,7 @@ S2.define('select2/core',[
var newVal = args[0];
if ($.isArray(newVal)) {
if ( Array.isArray( newVal ) ) {
newVal = $.map(newVal, function (obj) {
return obj.toString();
});

View File

@ -1430,7 +1430,7 @@ S2.define('select2/selection/base',[
// This needs to be delayed as the active element is the body when the
// key is pressed.
window.setTimeout(function () {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}, 1);
self._detachCloseHandler(container);
@ -1486,8 +1486,8 @@ S2.define('select2/selection/base',[
// Remove any focus when dropdown is closed by clicking outside the select area.
// Timeout of 1 required for close to finish wrapping up.
setTimeout(function(){
$this.find('*:focus').blur();
$target.focus();
$this.find('*:focus').trigger( 'blur' );
$target.trigger( 'focus' );
}, 1);
});
});
@ -1591,7 +1591,7 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) {
if (!container.isOpen()) {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}
});
@ -1737,7 +1737,7 @@ S2.define('select2/selection/multiple',[
// This gets reset automatically when focus is triggered.
self._keyUpPrevented = true;
self.$search.focus();
self.$search.trigger( 'focus' );
}, 1);
}
}
@ -2109,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch();
if (searchHadFocus) {
this.$search.focus();
this.$search.trigger( 'focus' );
}
};
@ -3547,7 +3547,7 @@ S2.define('select2/data/ajax',[
if (this._request != null) {
// JSONP requests cannot always be aborted
if ($.isFunction(this._request.abort)) {
if ('function' === typeof this._request.abort) {
this._request.abort();
}
@ -3572,7 +3572,7 @@ S2.define('select2/data/ajax',[
if (self.options.get('debug') && window.console && console.error) {
// Check to make sure that the response included a `results` key.
if (!results || !results.results || !$.isArray(results.results)) {
if (!results || !results.results || !Array.isArray(results.results)) {
console.error(
'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.'
@ -3631,7 +3631,7 @@ S2.define('select2/data/tags',[
decorated.call(this, $element, options);
if ($.isArray(tags)) {
if (Array.isArray(tags)) {
for (var t = 0; t < tags.length; t++) {
var tag = tags[t];
var item = this._normalizeItem(tag);
@ -3707,7 +3707,7 @@ S2.define('select2/data/tags',[
};
Tags.prototype.createTag = function (decorated, params) {
var term = $.trim(params.term);
var term = 'string' === typeof params.term ? params.term.trim() : '';
if (term === '') {
return null;
@ -3800,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
this.$search.focus();
this.$search.trigger( 'focus' );
}
params.term = tokenData.term;
@ -4047,10 +4047,10 @@ S2.define('select2/dropdown/search',[
container.on('open', function () {
self.$search.attr('tabindex', 0);
self.$search.attr('aria-owns', resultsId);
self.$search.focus();
self.$search.trigger( 'focus' );
window.setTimeout(function () {
self.$search.focus();
self.$search.trigger( 'focus' );
}, 0);
});
@ -4063,7 +4063,7 @@ S2.define('select2/dropdown/search',[
container.on('focus', function () {
if (!container.isOpen()) {
self.$search.focus();
self.$search.trigger( 'focus' );
}
});
@ -4878,7 +4878,7 @@ S2.define('select2/defaults',[
}
}
if ($.isArray(options.language)) {
if (Array.isArray(options.language)) {
var languages = new Translation();
options.language.push('en');
@ -4941,7 +4941,7 @@ S2.define('select2/defaults',[
function matcher (params, data) {
// Always return the object if there is nothing to compare
if ($.trim(params.term) === '') {
if ( 'undefined' === typeof params.term || ( 'string' === typeof params.term && '' === params.term.trim() ) ) {
return data;
}
@ -5513,7 +5513,7 @@ S2.define('select2/core',[
self.focusOnActiveElement();
} else {
// Focus on the search if user starts typing.
$searchField.focus();
$searchField.trigger( 'focus' );
// Focus back to active selection when finished typing.
// Small delay so typed character can be read by screen reader.
setTimeout(function(){
@ -5533,7 +5533,7 @@ S2.define('select2/core',[
Select2.prototype.focusOnActiveElement = function () {
// Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
if (this.isOpen() && ! Utils.isTouchscreen()) {
this.$results.find('li.select2-results__option--highlighted').focus();
this.$results.find('li.select2-results__option--highlighted').trigger( 'focus' );
}
};
@ -5724,7 +5724,7 @@ S2.define('select2/core',[
var newVal = args[0];
if ($.isArray(newVal)) {
if (Array.isArray(newVal)) {
newVal = $.map(newVal, function (obj) {
return obj.toString();
});
@ -5801,7 +5801,7 @@ S2.define('select2/compat/utils',[
function syncCssClasses ($dest, $src, adapter) {
var classes, replacements = [], adapted;
classes = $.trim($dest.attr('class'));
classes = 'string' === typeof $dest.attr('class') ? $dest.attr('class').trim() : '';
if (classes) {
classes = '' + classes; // for IE which returns object
@ -5814,7 +5814,7 @@ S2.define('select2/compat/utils',[
});
}
classes = $.trim($src.attr('class'));
classes = 'string' === typeof $src.attr('class') ? $src.attr('class').trim() : '';
if (classes) {
classes = '' + classes; // for IE which returns object
@ -5855,7 +5855,7 @@ S2.define('select2/compat/containerCss',[
var containerCssClass = this.options.get('containerCssClass') || '';
if ($.isFunction(containerCssClass)) {
if ('function' === typeof containerCssClass) {
containerCssClass = containerCssClass(this.$element);
}
@ -5881,7 +5881,7 @@ S2.define('select2/compat/containerCss',[
var containerCss = this.options.get('containerCss') || {};
if ($.isFunction(containerCss)) {
if ('function' === typeof containerCss) {
containerCss = containerCss(this.$element);
}
@ -5912,7 +5912,7 @@ S2.define('select2/compat/dropdownCss',[
var dropdownCssClass = this.options.get('dropdownCssClass') || '';
if ($.isFunction(dropdownCssClass)) {
if ('function' === typeof dropdownCssClass) {
dropdownCssClass = dropdownCssClass(this.$element);
}
@ -5938,7 +5938,7 @@ S2.define('select2/compat/dropdownCss',[
var dropdownCss = this.options.get('dropdownCss') || {};
if ($.isFunction(dropdownCss)) {
if ('function' === typeof dropdownCss) {
dropdownCss = dropdownCss(this.$element);
}
@ -5985,7 +5985,7 @@ S2.define('select2/compat/initSelection',[
this.initSelection.call(null, this.$element, function (data) {
self._isInitialized = true;
if (!$.isArray(data)) {
if (!Array.isArray(data)) {
data = [data];
}
@ -6131,7 +6131,7 @@ S2.define('select2/compat/matcher',[
function wrappedMatcher (params, data) {
var match = $.extend(true, {}, data);
if (params.term == null || $.trim(params.term) === '') {
if ( params.term == null || ( 'string' === typeof params.term && '' === params.term.trim() ) ) {
return match;
}
@ -6374,11 +6374,11 @@ S2.define('select2/selection/stopPropagation',[
$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
return fn ? this.on('mousewheel', fn) : this.trigger('mousewheel');
},
unmousewheel: function(fn) {
return this.unbind('mousewheel', fn);
return this.off('mousewheel', fn);
}
});

View File

@ -1430,7 +1430,7 @@ S2.define('select2/selection/base',[
// This needs to be delayed as the active element is the body when the
// key is pressed.
window.setTimeout(function () {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}, 1);
self._detachCloseHandler(container);
@ -1486,8 +1486,8 @@ S2.define('select2/selection/base',[
// Remove any focus when dropdown is closed by clicking outside the select area.
// Timeout of 1 required for close to finish wrapping up.
setTimeout(function(){
$this.find('*:focus').blur();
$target.focus();
$this.find('*:focus').trigger( 'blur' );
$target.trigger( 'focus' );
}, 1);
});
});
@ -1591,7 +1591,7 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) {
if (!container.isOpen()) {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}
});
@ -1737,7 +1737,7 @@ S2.define('select2/selection/multiple',[
// This gets reset automatically when focus is triggered.
self._keyUpPrevented = true;
self.$search.focus();
self.$search.trigger( 'focus' );
}, 1);
}
}
@ -2109,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch();
if (searchHadFocus) {
this.$search.focus();
this.$search.trigger( 'focus' );
}
};
@ -3547,7 +3547,7 @@ S2.define('select2/data/ajax',[
if (this._request != null) {
// JSONP requests cannot always be aborted
if ($.isFunction(this._request.abort)) {
if ( typeof this._request.abort === 'function' ) {
this._request.abort();
}
@ -3572,7 +3572,7 @@ S2.define('select2/data/ajax',[
if (self.options.get('debug') && window.console && console.error) {
// Check to make sure that the response included a `results` key.
if (!results || !results.results || !$.isArray(results.results)) {
if (!results || !results.results || ! Array.isArray( results.results ) ) {
console.error(
'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.'
@ -3631,7 +3631,7 @@ S2.define('select2/data/tags',[
decorated.call(this, $element, options);
if ($.isArray(tags)) {
if ( Array.isArray( tags ) ) {
for (var t = 0; t < tags.length; t++) {
var tag = tags[t];
var item = this._normalizeItem(tag);
@ -3707,7 +3707,7 @@ S2.define('select2/data/tags',[
};
Tags.prototype.createTag = function (decorated, params) {
var term = $.trim(params.term);
var term = params.term.trim();
if (term === '') {
return null;
@ -3800,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
this.$search.focus();
this.$search.trigger( 'focus' );
}
params.term = tokenData.term;
@ -4047,10 +4047,10 @@ S2.define('select2/dropdown/search',[
container.on('open', function () {
self.$search.attr('tabindex', 0);
self.$search.attr('aria-owns', resultsId);
self.$search.focus();
self.$search.trigger( 'focus' );
window.setTimeout(function () {
self.$search.focus();
self.$search.trigger( 'focus' );
}, 0);
});
@ -4063,7 +4063,7 @@ S2.define('select2/dropdown/search',[
container.on('focus', function () {
if (!container.isOpen()) {
self.$search.focus();
self.$search.trigger( 'focus' );
}
});
@ -4878,7 +4878,7 @@ S2.define('select2/defaults',[
}
}
if ($.isArray(options.language)) {
if ( Array.isArray( options.language ) ) {
var languages = new Translation();
options.language.push('en');
@ -4941,7 +4941,7 @@ S2.define('select2/defaults',[
function matcher (params, data) {
// Always return the object if there is nothing to compare
if ($.trim(params.term) === '') {
if ( params.term.trim() === '' ) {
return data;
}
@ -5513,7 +5513,7 @@ S2.define('select2/core',[
self.focusOnActiveElement();
} else {
// Focus on the search if user starts typing.
$searchField.focus();
$searchField.trigger( 'focus' );
// Focus back to active selection when finished typing.
// Small delay so typed character can be read by screen reader.
setTimeout(function(){
@ -5533,7 +5533,7 @@ S2.define('select2/core',[
Select2.prototype.focusOnActiveElement = function () {
// Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
if (this.isOpen() && ! Utils.isTouchscreen()) {
this.$results.find('li.select2-results__option--highlighted').focus();
this.$results.find('li.select2-results__option--highlighted').trigger( 'focus' );
}
};
@ -5724,7 +5724,7 @@ S2.define('select2/core',[
var newVal = args[0];
if ($.isArray(newVal)) {
if ( Array.isArray( newVal ) ) {
newVal = $.map(newVal, function (obj) {
return obj.toString();
});

View File

@ -32,9 +32,9 @@
th_index = th_index - 1;
// Determine (and/or reverse) sorting direction, default `asc`
var sort_dir = $this.data("sort-default") || dir.ASC;
if ($this.data("sort-dir"))
sort_dir = $this.data("sort-dir") === dir.ASC ? dir.DESC : dir.ASC;
var sort_dir = $this.data("sortDefault") || dir.ASC;
if ($this.data("sortDir"))
sort_dir = $this.data("sortDir") === dir.ASC ? dir.DESC : dir.ASC;
// Choose appropriate sorting function.
var type = $this.data("sort") || null;
@ -65,7 +65,7 @@
// with the TR itself into a tuple
trs.each(function(index,tr) {
var $e = $(tr).children().eq(th_index);
var sort_val = $e.data("sort-value");
var sort_val = $e.data("sortValue");
var order_by = typeof(sort_val) !== "undefined" ? sort_val : $e.text();
column.push([order_by, tr]);
});
@ -83,8 +83,8 @@
});
// Reset siblings
$table.find("th").data("sort-dir", null).removeClass("sorting-desc sorting-asc");
$this.data("sort-dir", sort_dir).addClass("sorting-"+sort_dir);
$table.find("th").data("sortDir", null).removeClass("sorting-desc sorting-asc");
$this.data("sortDir", sort_dir).addClass("sorting-"+sort_dir);
// Trigger `aftertablesort` event. Similar to `beforetablesort`
$table.trigger("aftertablesort", {column: $this.index(), direction: sort_dir});

View File

@ -125,12 +125,12 @@
// Skip the fade-in for IE8 and lower since it chokes on fading-in
// and changing position based on mousemovement at the same time.
$img.stop()
.fadeTo($.support.opacity ? settings.duration : 0, 1, $.isFunction(settings.onZoomIn) ? settings.onZoomIn.call(img) : false);
.fadeTo($.support.opacity ? settings.duration : 0, 1, 'function' === typeof settings.onZoomIn ? settings.onZoomIn.call(img) : false);
}
function stop() {
$img.stop()
.fadeTo(settings.duration, 0, $.isFunction(settings.onZoomOut) ? settings.onZoomOut.call(img) : false);
.fadeTo(settings.duration, 0, 'function' === typeof settings.onZoomOut ? settings.onZoomOut.call(img) : false);
}
// Mouse events
@ -222,7 +222,7 @@
});
}
if ($.isFunction(settings.callback)) {
if ('function' === typeof settings.callback) {
settings.callback.call(img);
}
};

View File

@ -267,16 +267,16 @@
},
{
"name": "symfony/console",
"version": "v5.2.6",
"version": "v5.2.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d"
"reference": "864568fdc0208b3eba3638b6000b69d2386e6768"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/35f039df40a3b335ebf310f244cb242b3a83ac8d",
"reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d",
"url": "https://api.github.com/repos/symfony/console/zipball/864568fdc0208b3eba3638b6000b69d2386e6768",
"reference": "864568fdc0208b3eba3638b6000b69d2386e6768",
"shasum": ""
},
"require": {
@ -344,7 +344,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v5.2.6"
"source": "https://github.com/symfony/console/tree/v5.2.8"
},
"funding": [
{
@ -360,20 +360,20 @@
"type": "tidelift"
}
],
"time": "2021-03-28T09:42:18+00:00"
"time": "2021-05-11T15:45:21+00:00"
},
{
"name": "symfony/finder",
"version": "v5.2.4",
"version": "v5.2.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "0d639a0943822626290d169965804f79400e6a04"
"reference": "ccccb9d48ca42757dd12f2ca4bf857a4e217d90d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/0d639a0943822626290d169965804f79400e6a04",
"reference": "0d639a0943822626290d169965804f79400e6a04",
"url": "https://api.github.com/repos/symfony/finder/zipball/ccccb9d48ca42757dd12f2ca4bf857a4e217d90d",
"reference": "ccccb9d48ca42757dd12f2ca4bf857a4e217d90d",
"shasum": ""
},
"require": {
@ -405,7 +405,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v5.2.4"
"source": "https://github.com/symfony/finder/tree/v5.2.9"
},
"funding": [
{
@ -421,7 +421,7 @@
"type": "tidelift"
}
],
"time": "2021-02-15T18:55:04+00:00"
"time": "2021-05-16T13:07:46+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -911,21 +911,21 @@
},
{
"name": "symfony/service-contracts",
"version": "v2.2.0",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1"
"reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1",
"reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
"reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"psr/container": "^1.0"
"psr/container": "^1.1"
},
"suggest": {
"symfony/service-implementation": ""
@ -933,7 +933,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
"dev-main": "2.4-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -970,7 +970,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/master"
"source": "https://github.com/symfony/service-contracts/tree/v2.4.0"
},
"funding": [
{
@ -986,20 +986,20 @@
"type": "tidelift"
}
],
"time": "2020-09-07T11:33:47+00:00"
"time": "2021-04-01T10:43:52+00:00"
},
{
"name": "symfony/string",
"version": "v5.2.6",
"version": "v5.2.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572"
"reference": "01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572",
"reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572",
"url": "https://api.github.com/repos/symfony/string/zipball/01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db",
"reference": "01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db",
"shasum": ""
},
"require": {
@ -1053,7 +1053,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v5.2.6"
"source": "https://github.com/symfony/string/tree/v5.2.8"
},
"funding": [
{
@ -1069,7 +1069,7 @@
"type": "tidelift"
}
],
"time": "2021-03-17T17:12:15+00:00"
"time": "2021-05-10T14:56:10+00:00"
}
],
"aliases": [],

View File

@ -251,16 +251,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.5.8",
"version": "3.6.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
"reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"shasum": ""
},
"require": {
@ -303,7 +303,7 @@
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2020-10-23T02:01:07+00:00"
"time": "2021-04-09T00:54:41+00:00"
},
{
"name": "woocommerce/woocommerce-sniffs",

View File

@ -155,16 +155,16 @@
},
{
"name": "mck89/peast",
"version": "v1.12.0",
"version": "v1.13.0",
"source": {
"type": "git",
"url": "https://github.com/mck89/peast.git",
"reference": "833be7a294627a8c5b1c482cbf489f73bf9b8086"
"reference": "db38b1524f5bda921cbda2385e440c2bb71d18b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mck89/peast/zipball/833be7a294627a8c5b1c482cbf489f73bf9b8086",
"reference": "833be7a294627a8c5b1c482cbf489f73bf9b8086",
"url": "https://api.github.com/repos/mck89/peast/zipball/db38b1524f5bda921cbda2385e440c2bb71d18b4",
"reference": "db38b1524f5bda921cbda2385e440c2bb71d18b4",
"shasum": ""
},
"require": {
@ -176,7 +176,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12.0-dev"
"dev-master": "1.13.0-dev"
}
},
"autoload": {
@ -187,7 +187,7 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
"BSD-3-Clause"
],
"authors": [
{
@ -198,9 +198,9 @@
"description": "Peast is PHP library that generates AST for JavaScript code",
"support": {
"issues": "https://github.com/mck89/peast/issues",
"source": "https://github.com/mck89/peast/tree/v1.12.0"
"source": "https://github.com/mck89/peast/tree/v1.13.0"
},
"time": "2021-01-08T15:16:19+00:00"
"time": "2021-05-22T16:06:09+00:00"
},
{
"name": "mustache/mustache",
@ -254,23 +254,30 @@
},
{
"name": "rmccue/requests",
"version": "v1.7.0",
"version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/rmccue/Requests.git",
"reference": "87932f52ffad70504d93f04f15690cf16a089546"
"url": "https://github.com/WordPress/Requests.git",
"reference": "afbe4790e4def03581c4a0963a1e8aa01f6030f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rmccue/Requests/zipball/87932f52ffad70504d93f04f15690cf16a089546",
"reference": "87932f52ffad70504d93f04f15690cf16a089546",
"url": "https://api.github.com/repos/WordPress/Requests/zipball/afbe4790e4def03581c4a0963a1e8aa01f6030f1",
"reference": "afbe4790e4def03581c4a0963a1e8aa01f6030f1",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"require-dev": {
"requests/test-server": "dev-master"
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.0",
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5",
"requests/test-server": "dev-master",
"squizlabs/php_codesniffer": "^3.5",
"wp-coding-standards/wpcs": "^2.0"
},
"type": "library",
"autoload": {
@ -289,7 +296,7 @@
}
],
"description": "A HTTP library written in PHP, for human beings.",
"homepage": "http://github.com/rmccue/Requests",
"homepage": "http://github.com/WordPress/Requests",
"keywords": [
"curl",
"fsockopen",
@ -300,10 +307,10 @@
"sockets"
],
"support": {
"issues": "https://github.com/rmccue/Requests/issues",
"source": "https://github.com/rmccue/Requests/tree/master"
"issues": "https://github.com/WordPress/Requests/issues",
"source": "https://github.com/WordPress/Requests/tree/v1.8.0"
},
"time": "2016-10-13T00:11:37+00:00"
"time": "2021-04-27T11:05:25+00:00"
},
{
"name": "symfony/finder",
@ -359,26 +366,26 @@
},
{
"name": "wp-cli/i18n-command",
"version": "v2.2.6",
"version": "v2.2.8",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/i18n-command.git",
"reference": "a66da3f09f6a728832381012848c3074bf1635c8"
"reference": "8bc234617edc533590ac0f41080164a8d85ec9ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/a66da3f09f6a728832381012848c3074bf1635c8",
"reference": "a66da3f09f6a728832381012848c3074bf1635c8",
"url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/8bc234617edc533590ac0f41080164a8d85ec9ce",
"reference": "8bc234617edc533590ac0f41080164a8d85ec9ce",
"shasum": ""
},
"require": {
"gettext/gettext": "^4.8",
"mck89/peast": "^1.8",
"wp-cli/wp-cli": "^2"
"wp-cli/wp-cli": "^2.5"
},
"require-dev": {
"wp-cli/scaffold-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^2.1.3"
"wp-cli/wp-cli-tests": "^3.0.11"
},
"type": "wp-cli-package",
"extra": {
@ -414,9 +421,9 @@
"homepage": "https://github.com/wp-cli/i18n-command",
"support": {
"issues": "https://github.com/wp-cli/i18n-command/issues",
"source": "https://github.com/wp-cli/i18n-command/tree/v2.2.6"
"source": "https://github.com/wp-cli/i18n-command/tree/v2.2.8"
},
"time": "2020-12-07T19:28:27+00:00"
"time": "2021-05-10T10:24:16+00:00"
},
{
"name": "wp-cli/mustangostang-spyc",
@ -525,23 +532,23 @@
},
{
"name": "wp-cli/wp-cli",
"version": "v2.4.1",
"version": "v2.5.0",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/wp-cli.git",
"reference": "ceb18598e79befa9b2a37a51efbb34910628988b"
"reference": "0bcf0c54f4d35685211d435e25219cc7acbe6d48"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/ceb18598e79befa9b2a37a51efbb34910628988b",
"reference": "ceb18598e79befa9b2a37a51efbb34910628988b",
"url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/0bcf0c54f4d35685211d435e25219cc7acbe6d48",
"reference": "0bcf0c54f4d35685211d435e25219cc7acbe6d48",
"shasum": ""
},
"require": {
"ext-curl": "*",
"mustache/mustache": "~2.13",
"php": "^5.4 || ^7.0",
"rmccue/requests": "~1.6",
"php": "^5.6 || ^7.0 || ^8.0",
"rmccue/requests": "^1.8",
"symfony/finder": ">2.7",
"wp-cli/mustangostang-spyc": "^0.6.3",
"wp-cli/php-cli-tools": "~0.11.2"
@ -552,7 +559,7 @@
"wp-cli/entity-command": "^1.2 || ^2",
"wp-cli/extension-command": "^1.1 || ^2",
"wp-cli/package-command": "^1 || ^2",
"wp-cli/wp-cli-tests": "^2.1"
"wp-cli/wp-cli-tests": "^3.0.7"
},
"suggest": {
"ext-readline": "Include for a better --prompt implementation",
@ -565,13 +572,17 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4.x-dev"
"dev-master": "2.5.x-dev"
}
},
"autoload": {
"psr-0": {
"WP_CLI": "php"
}
"WP_CLI\\": "php/"
},
"classmap": [
"php/class-wp-cli.php",
"php/class-wp-cli-command.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -588,7 +599,7 @@
"issues": "https://github.com/wp-cli/wp-cli/issues",
"source": "https://github.com/wp-cli/wp-cli"
},
"time": "2020-02-18T08:15:37+00:00"
"time": "2021-05-14T13:44:51+00:00"
}
],
"aliases": [],

View File

@ -3,7 +3,7 @@
read -p 'What date (YYYY-MM-DD) should we get contributions since? (i.e. date of previous release): ' from_date
read -sp 'Provide a personal access token (you must): ' auth_token
ignored_users="renovate-bot,apps/renovate,renovate,renovate[bot],github-actions[bot]"
ignored_users="renovate-bot,apps/renovate,renovate,renovate[bot],github-actions[bot],dependabot,dependabot[bot]"
output_file="contributors.html"
common_arguments="--owner woocommerce --fromDate $from_date --authToken $auth_token --cols 6 --sortBy contributions --format html --sortOrder desc --showlogin true --filter $ignored_users"

View File

@ -1,5 +1,136 @@
== Changelog ==
= 5.3.0 2021-05-11 =
**WooCommerce**
* Dev - Add support for "cities" and "postcodes" fields to the REST API endpoints to create/update tax rates. #29495
* Dev - The taxes GET endpoint now supports sorting by priority. #29495
* Enhancement - Add a new `woocommerce_cart_product_not_enough_stock_already_in_cart_message` filter to allow developers to filter an add-to-cart error when there isn't enough in stock taking into account what's already in the cart. #29304
* Enhancement - Pass `$handler`, and prevent logging from `woocommerce_logger_log_message` filter when the message is null. #29572
* Fix - Added parameter `$item` (instance of WC_Order_Item) to both the function `wc_downloadable_file_permission` and the filter hook `woocommerce_downloadable_file_permission`. #23188
* Fix - Add array-typed "cities" and "postcodes" to the response of the "tax" endpoint in the REST API to overcome the limitation of "city" and "postcode" returning always one single value. #27751
* Fix - Update tax rate for existing taxes when recalculating order totals. #27985
* Fix - Replace page setup dropdowns with AJAX powered search selects. #29181
* Fix - Return 0 if order isn't available in `WC_Payment_Gateway::get_order_total()`. #29314
* Fix - Fix console error on IE11 when opening admin pages. #29322
* Fix - Prevent crash when log file can't be opened for writing. #29396
* Fix - Closes the section "Store management insights" in email settings. #29447
* Fix - Fixed return type of `WC_Shortcode_Products::get_type()`. #29452
* Fix - Fix syntax error in the admin (products/orders) list table. #29469
* Fix - Cart duplicate debug shipping notices in certain situations. #29480
* Fix - Trying to update the cities or postcodes (only) or a tax rate via REST API returned an error. #29495
* Fix - Unneeded browser popup message of unsaved changes when adding a shipping zone with a shipping method. #29510
* Fix - Update the persistent cart after it's loaded on customer login. Fixes an issue whereby unavailable products would be validated on every login. #29517
* Fix - Updated `$customer->get_shipping()` and `$customer->get_billing()` to return the full address after updating individual fields. #29538
* Fix - Prevent cart to reset all nonce in front-end. #29542
* Fix - Bump the version of the "Grouped product add to cart" template to 4.8.0 (was still at 4.0.0 by mistake). #29601
* Fix - If we have a non-empty shipping address then do not overwrite the state or country fields with billing address data. #29605
* Tweak - Add the support to `optgroups` in single select on Settings API. #29145
* Tweak - Improves performance by avoiding an unnecessary redirect if custom permalink structure does not contain trailing slashes. #29422
* Tweak - Update SSR db version tooltip to more accurately state the db version. #29438
* Tweak - Adjust Twenty Twenty One order items header alignment. #29485
* Tweak - Lost password form alignment issues. #29496
* Tweak - Improve accessibility by adding `aria-hidden="true"` on strikethrough prices. #29603
* Tweak - Default store location to US California. #29654
* Tweak - Default store currency to USD. #29752
** WooCommerce Blocks - 4.8.0 & 4.9.0 & 4.9.1 **
* Dev - Removed legacy handling for SSR blocks that rendered shortcodes. #4010
* Fix - Customer address country saving to orders in certain circumstances. #4013
* Fix - Prevent error messages returned by the API from displaying raw HTML. #4005
* Fix - Proceed to checkout button click bug happening when the Coupon error is visible in the Cart block. #3996
* Fix - Use font color in payment methods border. #4051
* Fix - Load translation file for JS files that has translatable strings. #4050
* Fix - Stop shipping package titles line-breaks occurring in the middle of a word. #4049
* Fix - Fixed styling issues on the cart and checkout page in Twenty(X) themes. #4046
* Fix - Fix headline alignment in the empty state of the cart block. #4044
* Fix - Fix button alignment in Featured Product and Featured Category blocks. #4028
* Fix - Check if Cart and Checkout are registered before removing payment methods. #4056
* Enhancement - Registered payment methods now have access to the `shouldSavePayment` prop in their components (which indicates whether the shopper has checked the save payment method checkbox. #3990
* Enhancement - Payment methods implementing the `savedTokenComponent` configuration property will now have the `onPaymentProcessing` event available to the registered component. #3982
** WooCommerce Admin - 2.2.0 & 2.2.1 & 2.2.2 & 2.2.3 & 2.2.4 & 2.2.5 & 2.2.6 **
* Add - Next new novel navigation nudge note #6610
* Add - Add legacy report items to new navigation #6507
* Add - Add preview site button on the appearance task #6457
* Add - Back button to go to home screen from tasks in the task list. #6397
* Add - Add a "rather not say" option to revenue in the profile wizard. #6475
* Add - Remove Mollie promo note on install #6510
* Add - Remote Inbox Notifications rule to trigger when WooCommerce Admin is upgraded. #6040
* Add - CES survey for search product, order, customer #6420
* Add - CES survey for importing products #6419
* Add - CES survey for adding product categories, tags, and attributes #6418
* Add - Additional analytics tracking for the business details step. #6575
* Add - Include tracking for mail poet installs in the selective bundle install #6603
* Add - Paystack payment provider to several african countries. #6579
* Dev - Close activity panel tabs by default and track #6566
* Dev - Update undefined task name properties for help panel tracks #6565
* Dev - Refactor profile wizard benefits step and add tests #6583
* Dev - Add filter to profile wizard steps #6564
* Dev - Add nav intro modal tests #6518
* Dev - Use wc filter to get status tabs for tools category #6525
* Dev - Add nav header component tests #6509
* Dev - Add initial tests for navigation Menu class #6492
* Dev - Remove active item from navigation store #6486
* Dev - Add navigation container tests #6464
* Dev - Add nav favorite button tests #6446
* Dev - Add a changelog lint check to PRs. #6414
* Dev - Add navigation favorites tests #6409
* Dev - support use of Array.flat in client and packages. #6411
* Dev - Deprecate Onboarding::has_woocommerce_support. #6401
* Dev - Add Dependency Extraction Webpack Plugin #5762
* Dev - Add client-side filter for Navigation rootBackUrl #6505
* Dev - Remove `items_purchased` and `account_type` props from onboarding profile API. #6520
* Dev - Added warning when WC-Admin is active but not being used #6453
* Dev - Store profiler - Added MailPoet to Business Details step #6503
* Dev - Store profiler - Added MailPoet to new Business Details step #6515
* Dev - Add tilde (~) to represent client root directory for imports. #6517
* Dev - Add script automation for gathering hooks and filters. #6454
* Dev - Add TypeScript and page objects to the E2E test suite. #6582
* Dev - Introduce Typescript to Navigation utils #6477
* Dev - Payments task: include Mercado Pago #6572
* Dev - Ensure script asset.php files are included in builds #6635
* Dev - Ensure production script asset names don't include .min suffix #6681
* Dev - Do a git clean before the core release. #6945
* Dev - Fix a bug where trying to load an asset registry causes a crash. #6951
* Fix - Add check for navigating being enabled. #6462
* Fix - Move the shipping input and text 1px lower. #6408
* Fix - Correct the Klarna slug #6440
* Fix - Broken link anchors to online documentation. #6455
* Fix - Update payment card style on mobile #6413
* Fix - Missing i18n in Welcome modal. #6456
* Fix - Restore visual styles back to Analytics tabs. #5913
* Fix - Update contrast and hover / active colors for analytics dropdown buttons #6504
* Fix - Associated Order Number for refunds was hidden #6428
* Fix - Fix issue where Loader::is_admin_page() would error if WooCommerce admin is disabled. #6563
* Fix - Correct a bug where the JP connection flow would not happen when installing JP in the OBW. #6521
* Fix - Show management links when the task list is complete (even if its not hidden). #6657
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
* Fix - Update the Mercado option used for enabling/disabling. #6677
* Fix - Improve AddFirstProduct email note contents. #6617
* Fix - Check if features are currently being enabled #6688
* Fix - Fix the activity panel toggle not closing on click #6679
* Fix - Fix use of feature checks and remove deprecated method calls #6687
* Fix - Allow the manager role to query certain options #6577
* Fix - Delete customer data on network user deletion #6574
* Fix - Fix Themes step visibility in IE 11 #6578
* Fix - Fix hidden menu title on smaller screens #6562
* Fix - Add gross sales column to CSV export #6567
* Fix - Disable the continue btn on OBW when requested are being made #6838
* Fix - Calling of get_script_asset_filename with extra parameter #6955
* Fix - Address an issue with OBW when installing only WooCommerce payments and Jetpack. #6957
* Tweak - Add default value for contains op #6622
* Tweak - Adjust targeting store age for the Add First Product note #6554
* Tweak - Improve WC Shipping & Tax logic #6547
* Tweak - Update Insight inbox note content #6555
* Tweak - Remove mobile activity panel toggle #6539
* Tweak - Refactor autoloader to remove global variable. #6412
* Tweak - Revert WCPay international support for bundled package #6901
* Tweak - Store profiler - Changed MailPoet's title and description #6886
* Tweak - Update PayU logo #6829
= 5.2.2 2021-04-15 =
**WooCommerce**

View File

@ -21,8 +21,8 @@
"pelago/emogrifier": "3.1.0",
"psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.1.6",
"woocommerce/woocommerce-admin": "2.2.2",
"woocommerce/woocommerce-blocks": "4.9.1"
"woocommerce/woocommerce-admin": "2.3.1",
"woocommerce/woocommerce-blocks": "5.1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4"

72
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a604678b268820c78736d599e1eb6726",
"content-hash": "cf10f974b24dd9a696708cc95a0e3d6e",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -51,6 +51,9 @@
"GPL-2.0-or-later"
],
"description": "Creates a custom autoloader for a plugin or theme.",
"support": {
"source": "https://github.com/Automattic/jetpack-autoloader/tree/2.10.1"
},
"time": "2021-03-30T15:15:59+00:00"
},
{
@ -82,6 +85,9 @@
"GPL-2.0-or-later"
],
"description": "A wrapper for defining constants in a more testable way.",
"support": {
"source": "https://github.com/Automattic/jetpack-constants/tree/v1.5.1"
},
"time": "2020-10-28T19:00:31+00:00"
},
{
@ -214,6 +220,10 @@
"zend",
"zikula"
],
"support": {
"issues": "https://github.com/composer/installers/issues",
"source": "https://github.com/composer/installers/tree/v1.11.0"
},
"funding": [
{
"url": "https://packagist.com",
@ -288,6 +298,10 @@
"geolocation",
"maxmind"
],
"support": {
"issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues",
"source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.6.0"
},
"time": "2019-12-19T22:59:03+00:00"
},
{
@ -362,6 +376,10 @@
"email",
"pre-processing"
],
"support": {
"issues": "https://github.com/MyIntervals/emogrifier/issues",
"source": "https://github.com/MyIntervals/emogrifier"
},
"time": "2019-12-26T19:37:31+00:00"
},
{
@ -411,6 +429,10 @@
"container-interop",
"psr"
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/master"
},
"time": "2017-02-14T16:28:37+00:00"
},
{
@ -464,6 +486,9 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/css-selector/tree/master"
},
"time": "2017-05-01T15:01:29+00:00"
},
{
@ -499,20 +524,24 @@
],
"description": "Action Scheduler for WordPress and WooCommerce",
"homepage": "https://actionscheduler.org/",
"support": {
"issues": "https://github.com/woocommerce/action-scheduler/issues",
"source": "https://github.com/woocommerce/action-scheduler/tree/master"
},
"time": "2020-05-12T16:22:33+00:00"
},
{
"name": "woocommerce/woocommerce-admin",
"version": "2.2.2",
"version": "2.3.1",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git",
"reference": "161e6afa01a3fb69533cfa2b245a71df7512ec3f"
"reference": "f28cf3f027e27a6679e4fa8173d8b6859ec84838"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/161e6afa01a3fb69533cfa2b245a71df7512ec3f",
"reference": "161e6afa01a3fb69533cfa2b245a71df7512ec3f",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/f28cf3f027e27a6679e4fa8173d8b6859ec84838",
"reference": "f28cf3f027e27a6679e4fa8173d8b6859ec84838",
"shasum": ""
},
"require": {
@ -521,7 +550,7 @@
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "7.5.20",
"bamarni/composer-bin-plugin": "^1.4",
"suin/phpcs-psr4-sniff": "^2.2",
"woocommerce/woocommerce-sniffs": "0.1.0"
},
@ -531,6 +560,9 @@
"test": "Run unit tests",
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier"
},
"bamarni-bin": {
"target-directory": "bin/composer"
}
},
"autoload": {
@ -544,20 +576,24 @@
],
"description": "A modern, javascript-driven WooCommerce Admin experience.",
"homepage": "https://github.com/woocommerce/woocommerce-admin",
"time": "2021-04-29T14:11:48+00:00"
"support": {
"issues": "https://github.com/woocommerce/woocommerce-admin/issues",
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v2.3.1"
},
"time": "2021-05-24T09:48:40+00:00"
},
{
"name": "woocommerce/woocommerce-blocks",
"version": "v4.9.1",
"version": "v5.1.0",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
"reference": "62f32bfb45dfcb2ba3ca349a6ed0a8cf48ddefce"
"reference": "a4f168596f3832e161b26dec636b69293039ee51"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/62f32bfb45dfcb2ba3ca349a6ed0a8cf48ddefce",
"reference": "62f32bfb45dfcb2ba3ca349a6ed0a8cf48ddefce",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/a4f168596f3832e161b26dec636b69293039ee51",
"reference": "a4f168596f3832e161b26dec636b69293039ee51",
"shasum": ""
},
"require": {
@ -565,7 +601,7 @@
"composer/installers": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "6.5.14",
"phpunit/phpunit": "7.5.20",
"woocommerce/woocommerce-sniffs": "0.1.0"
},
"type": "wordpress-plugin",
@ -591,7 +627,11 @@
"gutenberg",
"woocommerce"
],
"time": "2021-04-13T16:11:16+00:00"
"support": {
"issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues",
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v5.1.0"
},
"time": "2021-05-10T15:01:42+00:00"
}
],
"packages-dev": [
@ -639,6 +679,10 @@
"isolation",
"tool"
],
"support": {
"issues": "https://github.com/bamarni/composer-bin-plugin/issues",
"source": "https://github.com/bamarni/composer-bin-plugin/tree/master"
},
"time": "2020-05-03T08:27:20+00:00"
}
],
@ -654,5 +698,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "1.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -1792,6 +1792,33 @@ return array(
'AE' => __( 'Armed Forces (AE)', 'woocommerce' ),
'AP' => __( 'Armed Forces (AP)', 'woocommerce' ),
),
'VE' => array( // Venezuela States. Ref: https://github.com/unicode-org/cldr/blob/release-38-1/common/subdivisions/en.xml#L5426-L5451
'A' => __( 'Capital', 'woocommerce' ),
'B' => __( 'Anzoátegui', 'woocommerce' ),
'C' => __( 'Apure', 'woocommerce' ),
'D' => __( 'Aragua', 'woocommerce' ),
'E' => __( 'Barinas', 'woocommerce' ),
'F' => __( 'Bolívar', 'woocommerce' ),
'G' => __( 'Carabobo', 'woocommerce' ),
'H' => __( 'Cojedes', 'woocommerce' ),
'I' => __( 'Falcón', 'woocommerce' ),
'J' => __( 'Guárico', 'woocommerce' ),
'K' => __( 'Lara', 'woocommerce' ),
'L' => __( 'Mérida', 'woocommerce' ),
'M' => __( 'Miranda', 'woocommerce' ),
'N' => __( 'Monagas', 'woocommerce' ),
'O' => __( 'Nueva Esparta', 'woocommerce' ),
'P' => __( 'Portuguesa', 'woocommerce' ),
'R' => __( 'Sucre', 'woocommerce' ),
'S' => __( 'Táchira', 'woocommerce' ),
'T' => __( 'Trujillo', 'woocommerce' ),
'U' => __( 'Yaracuy', 'woocommerce' ),
'V' => __( 'Zulia', 'woocommerce' ),
'W' => __( 'Federal Dependencies', 'woocommerce' ),
'X' => __( 'Vargas', 'woocommerce' ),
'Y' => __( 'Delta Amacuro', 'woocommerce' ),
'Z' => __( 'Amazonas', 'woocommerce' )
),
'VN' => array(),
'YT' => array(),
'ZA' => array( // South African states.

View File

@ -534,6 +534,73 @@ class WC_Admin_Addons {
<?php
}
/**
* Handles the output of a full-width block.
*
* @param array $section Section data.
*/
public static function output_promotion_block( $section ) {
if (
! current_user_can( 'install_plugins' ) ||
! current_user_can( 'activate_plugins' )
) {
return;
}
$section_object = (object) $section;
if ( ! empty( $section_object->geowhitelist ) ) {
$section_object->geowhitelist = explode( ',', $section_object->geowhitelist );
}
if ( ! empty( $section_object->geoblacklist ) ) {
$section_object->geoblacklist = explode( ',', $section_object->geoblacklist );
}
if ( ! self::show_extension( $section_object ) ) {
return;
}
?>
<div class="addons-banner-block addons-promotion-block">
<img
class="addons-img"
src="<?php echo esc_url( $section['image'] ); ?>"
alt="<?php echo esc_attr( $section['image_alt'] ); ?>"
/>
<div class="addons-promotion-block-content">
<h1 class="addons-promotion-block-title"><?php echo esc_html( $section['title'] ); ?></h1>
<div class="addons-promotion-block-description">
<?php echo wp_kses_post( $section['description'] ); ?>
</div>
<div class="addons-promotion-block-buttons">
<?php
if ( $section['button_1'] ) {
self::output_button(
$section['button_1_href'],
$section['button_1'],
'addons-button-expandable addons-button-solid',
$section['plugin']
);
}
if ( $section['button_2'] ) {
self::output_button(
$section['button_2_href'],
$section['button_2'],
'addons-button-expandable addons-button-outline-purple',
$section['plugin']
);
}
?>
</div>
</div>
</div>
<?php
}
/**
* Handles the outputting of featured sections
*
@ -566,6 +633,9 @@ class WC_Admin_Addons {
case 'wcpay_banner_block':
self::output_wcpay_banner_block( (array) $section );
break;
case 'promotion_block':
self::output_promotion_block( (array) $section );
break;
}
}
}

View File

@ -67,44 +67,12 @@ class WC_Admin_Notices {
/**
* Parses query to create nonces when available.
*
* @deprecated 5.4.0
* @param object $response The WP_REST_Response we're working with.
* @return object $response The prepared WP_REST_Response object.
*/
public static function prepare_note_with_nonce( $response ) {
if ( 'wc-update-db-reminder' !== $response->data['name'] || ! isset( $response->data['actions'] ) ) {
return $response;
}
foreach ( $response->data['actions'] as $action_key => $action ) {
$url_parts = ! empty( $action->query ) ? wp_parse_url( $action->query ) : '';
if ( ! isset( $url_parts['query'] ) ) {
continue;
}
wp_parse_str( $url_parts['query'], $params );
if ( array_key_exists( '_nonce_action', $params ) && array_key_exists( '_nonce_name', $params ) ) {
$org_params = $params;
// Check to make sure we're acting on the whitelisted nonce actions.
if ( 'wc_db_update' !== $params['_nonce_action'] && 'woocommerce_hide_notices_nonce' !== $params['_nonce_action'] ) {
continue;
}
unset( $org_params['_nonce_action'] );
unset( $org_params['_nonce_name'] );
$url = $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'];
$nonce = array( $params['_nonce_name'] => wp_create_nonce( $params['_nonce_action'] ) );
$merged_params = array_merge( $nonce, $org_params );
$parsed_query = add_query_arg( $merged_params, $url );
$response->data['actions'][ $action_key ]->query = $parsed_query;
$response->data['actions'][ $action_key ]->url = $parsed_query;
}
}
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '5.4.0' );
return $response;
}

View File

@ -3,8 +3,6 @@
* Adds settings to the permalinks admin settings page
*
* @class WC_Admin_Permalink_Settings
* @author WooThemes
* @category Admin
* @package WooCommerce\Admin
* @version 2.3.0
*/
@ -140,23 +138,23 @@ class WC_Admin_Permalink_Settings {
<?php wp_nonce_field( 'wc-permalinks', 'wc-permalinks-nonce' ); ?>
<script type="text/javascript">
jQuery( function() {
jQuery('input.wctog').change(function() {
jQuery('input.wctog').on( 'change', function() {
jQuery('#woocommerce_permalink_structure').val( jQuery( this ).val() );
});
jQuery('.permalink-structure input').change(function() {
jQuery('.permalink-structure input').on( 'change', function() {
jQuery('.wc-permalink-structure').find('code.non-default-example, code.default-example').hide();
if ( jQuery(this).val() ) {
jQuery('.wc-permalink-structure code.non-default-example').show();
jQuery('.wc-permalink-structure input').removeAttr('disabled');
jQuery('.wc-permalink-structure input').prop('disabled', false);
} else {
jQuery('.wc-permalink-structure code.default-example').show();
jQuery('.wc-permalink-structure input:eq(0)').click();
jQuery('.wc-permalink-structure input:eq(0)').trigger( 'click' );
jQuery('.wc-permalink-structure input').attr('disabled', 'disabled');
}
});
jQuery('.permalink-structure input:checked').change();
jQuery('#woocommerce_permalink_structure').focus( function(){
jQuery('#woocommerce_custom_selection').click();
jQuery('.permalink-structure input:checked').trigger( 'change' );
jQuery('#woocommerce_permalink_structure').on( 'focus', function(){
jQuery('#woocommerce_custom_selection').trigger( 'click' );
} );
} );
</script>

View File

@ -254,12 +254,12 @@ class WC_Admin_Pointers {
button2 = $( '<a class=\"button button-primary\" href=\"#\">' + next + '</a>' ),
wrapper = $( '<div class=\"wc-pointer-buttons\" />' );
button.bind( 'click.pointer', function(e) {
button.on( 'click.pointer', function(e) {
e.preventDefault();
t.element.pointer('destroy');
});
button2.bind( 'click.pointer', function(e) {
button2.on( 'click.pointer', function(e) {
e.preventDefault();
t.element.pointer('close');
});

View File

@ -7,6 +7,7 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Utilities\ArrayUtil;
defined( 'ABSPATH' ) || exit;
@ -37,7 +38,8 @@ class WC_Admin_Status {
wp_die( 'Cannot load the REST API to access WC_REST_System_Status_Tools_Controller.' );
}
$tools = self::get_tools();
$tools = self::get_tools();
$tool_requires_refresh = false;
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'debug_action' ) ) { // WPCS: input var ok, sanitization ok.
$tools_controller = new WC_REST_System_Status_Tools_Controller();
@ -46,14 +48,16 @@ class WC_Admin_Status {
if ( array_key_exists( $action, $tools ) ) {
$response = $tools_controller->execute_tool( $action );
$tool = $tools[ $action ];
$tool = array(
$tool = $tools[ $action ];
$tool_requires_refresh = ArrayUtil::get_value_or_default( $tool, 'requires_refresh', false );
$tool = array(
'id' => $action,
'name' => $tool['name'],
'action' => $tool['button'],
'description' => $tool['desc'],
'disabled' => ArrayUtil::get_value_or_default( $tool, 'disabled', false ),
);
$tool = array_merge( $tool, $response );
$tool = array_merge( $tool, $response );
/**
* Fires after a WooCommerce system status tool has been executed.
@ -80,6 +84,10 @@ class WC_Admin_Status {
echo '<div class="updated inline"><p>' . esc_html__( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>';
}
if ( $tool_requires_refresh ) {
$tools = self::get_tools();
}
include_once __DIR__ . '/views/html-admin-page-status-tools.php';
}

View File

@ -454,6 +454,7 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
'method_id',
'cost',
'_reduced_stock',
'_restock_refunded_items',
)
);

View File

@ -56,7 +56,7 @@ class WC_Marketplace_Suggestions {
}
/**
* Render additional panels in the proudct data metabox.
* Render additional panels in the product data metabox.
*/
public static function product_data_panels() {
include dirname( __FILE__ ) . '/templates/html-product-data-extensions.php';

View File

@ -17,6 +17,7 @@ $hidden_order_itemmeta = apply_filters(
'method_id',
'cost',
'_reduced_stock',
'_restock_refunded_items',
)
);
?><div class="view">

View File

@ -189,7 +189,10 @@ if ( wc_tax_enabled() ) {
<td class="label"><?php echo esc_html( $tax_total->label ); ?>:</td>
<td width="1%"></td>
<td class="total">
<?php echo wc_price( $tax_total->amount, array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php
// We use wc_round_tax_total here because tax may need to be round up or round down depending upon settings, whereas wc_price alone will always round it down.
echo wc_price( wc_round_tax_total( $tax_total->amount ), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</td>
</tr>
<?php endforeach; ?>

View File

@ -109,24 +109,23 @@ class WC_Notes_Run_Db_Update {
* @return int Created/Updated note id
*/
private static function update_needed_notice( $note_id = null ) {
$update_url = html_entity_decode(
$update_url =
add_query_arg(
array(
'do_update_woocommerce' => 'true',
'_nonce_action' => 'wc_db_update',
'_nonce_name' => 'wc_db_update_nonce',
),
wc_get_current_admin_url() ? wc_get_current_admin_url() : admin_url( 'admin.php?page=wc-settings' )
)
);
);
$note_actions = array(
array(
'name' => 'update-db_run',
'label' => __( 'Update WooCommerce Database', 'woocommerce' ),
'url' => $update_url,
'status' => 'unactioned',
'primary' => true,
'name' => 'update-db_run',
'label' => __( 'Update WooCommerce Database', 'woocommerce' ),
'url' => $update_url,
'status' => 'unactioned',
'primary' => true,
'nonce_action' => 'wc_db_update',
'nonce_name' => 'wc_db_update_nonce',
),
array(
'name' => 'update-db_learn-more',
@ -166,6 +165,10 @@ class WC_Notes_Run_Db_Update {
$note->clear_actions();
foreach ( $note_actions as $note_action ) {
$note->add_action( ...array_values( $note_action ) );
if ( isset( $note_action['nonce_action'] ) ) {
$note->add_nonce_to_action( $note_action['name'], $note_action['nonce_action'], $note_action['nonce_name'] );
}
}
return $note->save();
@ -212,8 +215,6 @@ class WC_Notes_Run_Db_Update {
add_query_arg(
array(
'wc-hide-notice' => 'update',
'_nonce_action' => 'woocommerce_hide_notices_nonce',
'_nonce_name' => '_wc_notice_nonce',
),
wc_get_current_admin_url() ? remove_query_arg( 'do_update_woocommerce', wc_get_current_admin_url() ) : admin_url( 'admin.php?page=wc-settings' )
)
@ -221,11 +222,13 @@ class WC_Notes_Run_Db_Update {
$note_actions = array(
array(
'name' => 'update-db_done',
'label' => __( 'Thanks!', 'woocommerce' ),
'url' => $hide_notices_url,
'status' => 'actioned',
'primary' => true,
'name' => 'update-db_done',
'label' => __( 'Thanks!', 'woocommerce' ),
'url' => $hide_notices_url,
'status' => 'actioned',
'primary' => true,
'nonce_action' => 'woocommerce_hide_notices_nonce',
'nonce_name' => '_wc_notice_nonce',
),
);
@ -242,6 +245,10 @@ class WC_Notes_Run_Db_Update {
$note->clear_actions();
foreach ( $note_actions as $note_action ) {
$note->add_action( ...array_values( $note_action ) );
if ( isset( $note_action['nonce_action'] ) ) {
$note->add_nonce_to_action( $note_action['name'], $note_action['nonce_action'], $note_action['nonce_name'] );
}
}
$note->save();

View File

@ -157,7 +157,7 @@ class WC_Plugins_Screen_Updates extends WC_Plugin_Updates {
$update_link.removeClass( 'wc-thickbox open-plugin-details-modal' );
$update_link.addClass( 'update-link' );
$update_link.attr( 'href', update_url );
$update_link.click();
$update_link.trigger( 'click' );
});
$( '#wc_untested_extensions_modal .cancel' ).on( 'click', function( evt ) {

View File

@ -69,7 +69,7 @@ class WC_Updates_Screen_Updates extends WC_Plugin_Updates {
}
var $checkbox = $( 'input[value="woocommerce/woocommerce.php"]' );
if ( $checkbox.prop( 'checked' ) ) {
$( '#wc-upgrade-warning' ).click();
$( '#wc-upgrade-warning' ).trigger( 'click' );
}
}

View File

@ -343,9 +343,9 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
} );
jQuery( '.section' ).slideUp( 100, function() {
<?php if ( empty( $this->coupon_codes ) ) : ?>
jQuery( '.section_title:eq(1)' ).click();
jQuery( '.section_title:eq(1)' ).trigger( 'click' );
<?php else : ?>
jQuery( '.section_title:eq(0)' ).click();
jQuery( '.section_title:eq(0)' ).trigger( 'click' );
<?php endif; ?>
} );
</script>
@ -551,15 +551,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
}
);
jQuery('.chart-placeholder').resize();
jQuery('.chart-placeholder').trigger( 'resize' );
}
drawGraph();
jQuery('.highlight_series').hover(
jQuery('.highlight_series').on( 'mouseenter',
function() {
drawGraph( jQuery(this).data('series') );
},
} ).on( 'mouseleave',
function() {
drawGraph();
}

View File

@ -155,7 +155,7 @@ class WC_Report_Customers extends WC_Admin_Report {
}
);
jQuery('.chart-placeholder.customers_vs_guests').resize();
jQuery('.chart-placeholder.customers_vs_guests').trigger( 'resize' );
});
</script>
<?php
@ -412,15 +412,15 @@ class WC_Report_Customers extends WC_Admin_Report {
],
}
);
jQuery('.chart-placeholder').resize();
jQuery('.chart-placeholder').trigger( 'resize' );
}
drawGraph();
jQuery('.highlight_series').hover(
jQuery('.highlight_series').on( 'mouseenter',
function() {
drawGraph( jQuery(this).data('series') );
},
} ).on( 'mouseleave',
function() {
drawGraph();
}

View File

@ -12,8 +12,6 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* WC_Report_Sales_By_Category
*
* @author WooThemes
* @category Admin
* @package WooCommerce\Admin\Reports
* @version 2.1.0
*/
@ -171,11 +169,11 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
switch ( $this->chart_groupby ) {
case 'day':
$time = strtotime( date( 'Ymd', strtotime( $order_item->post_date ) ) ) * 1000;
$time = strtotime( gmdate( 'Ymd', strtotime( $order_item->post_date ) ) ) * 1000;
break;
case 'month':
default:
$time = strtotime( date( 'Ym', strtotime( $order_item->post_date ) ) . '01' ) * 1000;
$time = strtotime( gmdate( 'Ym', strtotime( $order_item->post_date ) ) . '01' ) * 1000;
break;
}
@ -244,13 +242,13 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
// Select all/None
jQuery( '.chart-widget' ).on( 'click', '.select_all', function() {
jQuery(this).closest( 'div' ).find( 'select option' ).attr( 'selected', 'selected' );
jQuery(this).closest( 'div' ).find('select').change();
jQuery(this).closest( 'div' ).find('select').trigger( 'change' );
return false;
});
jQuery( '.chart-widget').on( 'click', '.select_none', function() {
jQuery(this).closest( 'div' ).find( 'select option' ).removeAttr( 'selected' );
jQuery(this).closest( 'div' ).find('select').change();
jQuery(this).closest( 'div' ).find( 'select option' ).prop( 'selected', false );
jQuery(this).closest( 'div' ).find('select').trigger( 'change' );
return false;
});
});
@ -307,11 +305,11 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
switch ( $this->chart_groupby ) {
case 'day':
$time = strtotime( date( 'Ymd', strtotime( "+{$i} DAY", $this->start_date ) ) ) * 1000;
$time = strtotime( gmdate( 'Ymd', strtotime( "+{$i} DAY", $this->start_date ) ) ) * 1000;
break;
case 'month':
default:
$time = strtotime( date( 'Ym', strtotime( "+{$i} MONTH", $this->start_date ) ) . '01' ) * 1000;
$time = strtotime( gmdate( 'Ym', strtotime( "+{$i} MONTH", $this->start_date ) ) . '01' ) * 1000;
break;
}
@ -430,16 +428,16 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
}
);
jQuery('.chart-placeholder').resize();
jQuery('.chart-placeholder').trigger( 'resize' );
}
drawGraph();
jQuery('.highlight_series').hover(
jQuery('.highlight_series').on( 'mouseenter',
function() {
drawGraph( jQuery(this).data('series') );
},
} ).on( 'mouseleave',
function() {
drawGraph();
}

View File

@ -849,15 +849,15 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
}
);
jQuery('.chart-placeholder').resize();
jQuery('.chart-placeholder').trigger( 'resize' );
}
drawGraph();
jQuery('.highlight_series').hover(
jQuery('.highlight_series').on( 'mouseenter',
function() {
drawGraph( jQuery(this).data('series') );
},
} ).on( 'mouseleave',
function() {
drawGraph();
}

View File

@ -389,7 +389,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
} );
jQuery( '.section' ).slideUp( 100, function() {
<?php if ( empty( $this->product_ids ) ) : ?>
jQuery( '.section_title:eq(1)' ).click();
jQuery( '.section_title:eq(1)' ).trigger( 'click' );
<?php endif; ?>
} );
</script>
@ -610,15 +610,15 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
}
);
jQuery('.chart-placeholder').resize();
jQuery('.chart-placeholder').trigger( 'resize' );
}
drawGraph();
jQuery('.highlight_series').hover(
jQuery('.highlight_series').on( 'mouseenter',
function() {
drawGraph( jQuery(this).data('series') );
},
} ).on( 'mouseleave',
function() {
drawGraph();
}

View File

@ -63,7 +63,8 @@ if ( ! defined( 'ABSPATH' ) ) {
$topic_data = WC_Admin_Webhooks::get_topic_data( $webhook );
$topics = apply_filters(
'woocommerce_webhook_topics', array(
'woocommerce_webhook_topics',
array(
'' => __( 'Select an option&hellip;', 'woocommerce' ),
'coupon.created' => __( 'Coupon created', 'woocommerce' ),
'coupon.updated' => __( 'Coupon updated', 'woocommerce' ),
@ -197,8 +198,10 @@ if ( ! defined( 'ABSPATH' ) ) {
add_query_arg(
array(
'delete' => $webhook->get_id(),
), admin_url( 'admin.php?page=wc-settings&tab=advanced&section=webhooks' )
), 'delete-webhook'
),
admin_url( 'admin.php?page=wc-settings&tab=advanced&section=webhooks' )
),
'delete-webhook'
);
?>
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( $delete_url ); ?>"><?php esc_html_e( 'Delete permanently', 'woocommerce' ); ?></a>
@ -221,6 +224,6 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( 'action' === current ) {
action_event_field.show();
}
}).change();
}).trigger( 'change' );
});
</script>

View File

@ -56,8 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) {
value="<?php echo esc_attr( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>"
placeholder="<?php esc_attr_e( 'Enter a search term and press enter', 'woocommerce' ); ?>">
<input type="hidden" name="page" value="wc-addons">
<?php $page_section = ( isset( $_GET['section'] ) && '_featured' !== $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '_all'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
<input type="hidden" name="section" value="<?php echo esc_attr( $page_section ); ?>">
<input type="hidden" name="section" value="_all">
</form>
<?php if ( '_featured' === $current_section ) : ?>
<div class="addons-featured">

View File

@ -1,8 +1,12 @@
<?php
/**
* Admin View: Page - Status Tools
*
* @package WooCommerce
*/
use Automattic\WooCommerce\Utilities\ArrayUtil;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -12,14 +16,14 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php settings_fields( 'woocommerce_status_settings_fields' ); ?>
<table class="wc_status_table wc_status_table--tools widefat" cellspacing="0">
<tbody class="tools">
<?php foreach ( $tools as $action => $tool ) : ?>
<tr class="<?php echo sanitize_html_class( $action ); ?>">
<?php foreach ( $tools as $action_name => $tool ) : ?>
<tr class="<?php echo sanitize_html_class( $action_name ); ?>">
<th>
<strong class="name"><?php echo esc_html( $tool['name'] ); ?></strong>
<p class="description"><?php echo wp_kses_post( $tool['desc'] ); ?></p>
</th>
<td class="run-tool">
<a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=' . $action ), 'debug_action' ); ?>" class="button button-large <?php echo esc_attr( $action ); ?>"><?php echo esc_html( $tool['button'] ); ?></a>
<a <?php echo ArrayUtil::is_truthy( $tool, 'disabled' ) ? 'disabled' : ''; ?> href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=' . $action_name ), 'debug_action' ) ); ?>" class="button button-large <?php echo esc_attr( $action_name ); ?>"><?php echo esc_html( $tool['button'] ); ?></a>
</td>
</tr>
<?php endforeach; ?>

View File

@ -206,17 +206,19 @@ function wc_maybe_adjust_line_item_product_stock( $item, $item_quantity = -1 ) {
return false;
}
$product = $item->get_product();
$item_quantity = wc_stock_amount( $item_quantity >= 0 ? $item_quantity : $item->get_quantity() );
$already_reduced_stock = wc_stock_amount( $item->get_meta( '_reduced_stock', true ) );
$product = $item->get_product();
if ( ! $product || ! $product->managing_stock() ) {
return false;
}
$item_quantity = wc_stock_amount( $item_quantity >= 0 ? $item_quantity : $item->get_quantity() );
$already_reduced_stock = wc_stock_amount( $item->get_meta( '_reduced_stock', true ) );
$restock_refunded_items = wc_stock_amount( $item->get_meta( '_restock_refunded_items', true ) );
$order = $item->get_order();
$refunded_item_quantity = $order->get_qty_refunded_for_item( $item->get_id() );
$diff = $item_quantity + $refunded_item_quantity - $already_reduced_stock;
$diff = $item_quantity - $restock_refunded_items - $already_reduced_stock;
/*
* 0 as $item_quantity usually indicates we're deleting the order item.
@ -238,7 +240,7 @@ function wc_maybe_adjust_line_item_product_stock( $item, $item_quantity = -1 ) {
return $new_stock;
}
$item->update_meta_data( '_reduced_stock', $item_quantity + $refunded_item_quantity );
$item->update_meta_data( '_reduced_stock', $item_quantity - $restock_refunded_items );
$item->save();
if ( $item_quantity > 0 ) {

View File

@ -1002,6 +1002,8 @@ class WC_AJAX {
);
if ( strstr( $amount, '%' ) ) {
// We need to calculate totals first, so that $order->get_total() is correct.
$order->calculate_totals( false );
$formatted_amount = $amount;
$percent = floatval( trim( $amount, '%' ) );
$amount = $order->get_total() * ( $percent / 100 );

View File

@ -42,14 +42,33 @@ class WC_Cache_Helper {
*/
public static function additional_nocache_headers( $headers ) {
$agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$set_cache = false;
/**
* Allow plugins to enable nocache headers. Enabled for Google weblight.
*
* @see https://support.google.com/webmasters/answer/1061943?hl=en
* @param bool $enable_nocache_headers Flag indicating whether to add nocache headers. Default: false.
*/
if ( false !== strpos( $agent, 'googleweblight' ) || apply_filters( 'woocommerce_enable_nocache_headers', false ) ) {
if ( apply_filters( 'woocommerce_enable_nocache_headers', false ) ) {
$set_cache = true;
}
/**
* Enabled for Google weblight.
*
* @see https://support.google.com/webmasters/answer/1061943?hl=en
*/
if ( false !== strpos( $agent, 'googleweblight' ) ) {
// no-transform: Opt-out of Google weblight. https://support.google.com/webmasters/answer/6211428?hl=en.
$set_cache = true;
}
if ( false !== strpos( $agent, 'Chrome' ) && is_cart() ) {
$set_cache = true;
}
if ( $set_cache ) {
$headers['Cache-Control'] = 'no-transform, no-cache, no-store, must-revalidate';
}
return $headers;

View File

@ -750,8 +750,9 @@ final class WC_Cart_Totals {
$items_subtotal = $this->get_rounded_items_total( $this->get_values_for_total( 'subtotal' ) );
$this->set_total( 'items_subtotal', NumberUtil::round( $items_subtotal ) );
$this->set_total( 'items_subtotal_tax', wc_round_tax_total( array_sum( $merged_subtotal_taxes ), 0 ) );
// Prices are not rounded here because they should already be rounded based on settings in `get_rounded_items_total` and in `round_line_tax` method calls.
$this->set_total( 'items_subtotal', $items_subtotal );
$this->set_total( 'items_subtotal_tax', array_sum( $merged_subtotal_taxes ), 0 );
$this->cart->set_subtotal( $this->get_total( 'items_subtotal' ) );
$this->cart->set_subtotal_tax( $this->get_total( 'items_subtotal_tax' ) );
@ -788,7 +789,7 @@ final class WC_Cart_Totals {
if ( $item->product->is_taxable() ) {
// Item subtotals were sent, so set 3rd param.
$item_tax = wc_round_tax_total( array_sum( WC_Tax::calc_tax( $coupon_discount, $item->tax_rates, $item->price_includes_tax ) ), 0 );
$item_tax = array_sum( WC_Tax::calc_tax( $coupon_discount, $item->tax_rates, $item->price_includes_tax ) );
// Sum total tax.
$coupon_discount_tax_amounts[ $coupon_code ] += $item_tax;
@ -862,7 +863,10 @@ final class WC_Cart_Totals {
*/
protected function calculate_totals() {
$this->set_total( 'total', NumberUtil::round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ), 0 ) );
$this->cart->set_total_tax( array_sum( $this->get_merged_taxes( false ) ) );
$items_tax = array_sum( $this->get_merged_taxes( false, array( 'items' ) ) );
// Shipping and fee taxes are rounded seperately because they were entered excluding taxes (as opposed to item prices, which may or may not be including taxes depending upon settings).
$shipping_and_fee_taxes = NumberUtil::round( array_sum( $this->get_merged_taxes( false, array( 'fees', 'shipping' ) ) ), wc_get_price_decimals() );
$this->cart->set_total_tax( $items_tax + $shipping_and_fee_taxes );
// Allow plugins to hook and alter totals before final total is calculated.
if ( has_action( 'woocommerce_calculate_totals' ) ) {

View File

@ -430,7 +430,7 @@ class WC_Cart extends WC_Legacy_Cart {
* @param string $value Value to set.
*/
public function set_subtotal( $value ) {
$this->totals['subtotal'] = wc_format_decimal( $value, wc_get_price_decimals() );
$this->totals['subtotal'] = wc_format_decimal( $value );
}
/**
@ -470,7 +470,7 @@ class WC_Cart extends WC_Legacy_Cart {
* @param string $value Value to set.
*/
public function set_shipping_total( $value ) {
$this->totals['shipping_total'] = wc_format_decimal( $value, wc_get_price_decimals() );
$this->totals['shipping_total'] = wc_format_decimal( $value );
}
/**
@ -490,7 +490,7 @@ class WC_Cart extends WC_Legacy_Cart {
* @param string $value Value to set.
*/
public function set_cart_contents_total( $value ) {
$this->totals['cart_contents_total'] = wc_format_decimal( $value, wc_get_price_decimals() );
$this->totals['cart_contents_total'] = wc_format_decimal( $value );
}
/**
@ -531,7 +531,7 @@ class WC_Cart extends WC_Legacy_Cart {
* @param string $value Value to set.
*/
public function set_fee_total( $value ) {
$this->totals['fee_total'] = wc_format_decimal( $value, wc_get_price_decimals() );
$this->totals['fee_total'] = wc_format_decimal( $value );
}
/**

View File

@ -679,6 +679,8 @@ class WC_Checkout {
// phpcs:enable WordPress.Security.NonceVerification.Missing
$skipped = array();
$form_was_shown = isset( $_POST['woocommerce-process-checkout-nonce'] ); // phpcs:disable WordPress.Security.NonceVerification.Missing
foreach ( $this->get_checkout_fields() as $fieldset_key => $fieldset ) {
if ( $this->maybe_skip_fieldset( $fieldset_key, $data ) ) {
$skipped[] = $fieldset_key;
@ -688,25 +690,32 @@ class WC_Checkout {
foreach ( $fieldset as $key => $field ) {
$type = sanitize_title( isset( $field['type'] ) ? $field['type'] : 'text' );
// phpcs:disable WordPress.Security.NonceVerification.Missing
switch ( $type ) {
case 'checkbox':
$value = isset( $_POST[ $key ] ) ? 1 : '';
break;
case 'multiselect':
$value = isset( $_POST[ $key ] ) ? implode( ', ', wc_clean( wp_unslash( $_POST[ $key ] ) ) ) : '';
break;
case 'textarea':
$value = isset( $_POST[ $key ] ) ? wc_sanitize_textarea( wp_unslash( $_POST[ $key ] ) ) : '';
break;
case 'password':
$value = isset( $_POST[ $key ] ) ? wp_unslash( $_POST[ $key ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
break;
default:
$value = isset( $_POST[ $key ] ) ? wc_clean( wp_unslash( $_POST[ $key ] ) ) : '';
break;
if ( isset( $_POST[ $key ] ) && '' !== $_POST[ $key ] ) { // phpcs:disable WordPress.Security.NonceVerification.Missing
$value = wp_unslash( $_POST[ $key ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
} elseif ( isset( $field['default'] ) && 'checkbox' !== $type && ! $form_was_shown ) {
$value = $field['default'];
} else {
$value = '';
}
if ( '' !== $value ) {
switch ( $type ) {
case 'checkbox':
$value = 1;
break;
case 'multiselect':
$value = implode( ', ', wc_clean( $value ) );
break;
case 'textarea':
$value = wc_sanitize_textarea( $value );
break;
case 'password':
break;
default:
$value = wc_clean( $value );
break;
}
}
// phpcs:enable WordPress.Security.NonceVerification.Missing
$data[ $key ] = apply_filters( 'woocommerce_process_checkout_' . $type . '_field', apply_filters( 'woocommerce_process_checkout_field_' . $key, $value ) );
}
@ -1123,7 +1132,7 @@ class WC_Checkout {
*/
public function process_checkout() {
try {
$nonce_value = wc_get_var( $_REQUEST['woocommerce-process-checkout-nonce'], wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // @codingStandardsIgnoreLine.
$nonce_value = wc_get_var( $_REQUEST['woocommerce-process-checkout-nonce'], wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // phpcs:ignore
if ( empty( $nonce_value ) || ! wp_verify_nonce( $nonce_value, 'woocommerce-process_checkout' ) ) {
WC()->session->set( 'refresh_totals', true );

View File

@ -365,7 +365,7 @@ class WC_Countries {
* @return string[]
*/
public function get_european_union_countries( $type = '' ) {
$countries = array( 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' );
$countries = array( 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' );
if ( 'eu_vat' === $type ) {
$countries[] = 'MC';
@ -383,7 +383,7 @@ class WC_Countries {
*/
public function countries_using_vat() {
wc_deprecated_function( 'countries_using_vat', '4.0', 'WC_Countries::get_vat_countries' );
$countries = array( 'AL', 'AR', 'AZ', 'BS', 'BH', 'BY', 'BB', 'BO', 'EG', 'ET', 'CL', 'CO', 'EC', 'SV', 'FJ', 'GM', 'GH', 'GT', 'IN', 'IR', 'IL', 'KZ', 'MU', 'MK', 'MX', 'MD', 'MN', 'ME', 'NA', 'NP', 'NG', 'PS', 'PY', 'RU', 'RW', 'KN', 'SA', 'RS', 'ZA', 'KR', 'LK', 'TH', 'TR', 'UA', 'UY', 'UZ', 'VE', 'VN', 'AE' );
$countries = array( 'AE', 'AL', 'AR', 'AZ', 'BB', 'BH', 'BO', 'BS', 'BY', 'CL', 'CO', 'EC', 'EG', 'ET', 'FJ', 'GH', 'GM', 'GT', 'IL', 'IN', 'IR', 'KN', 'KR', 'KZ', 'LK', 'MD', 'ME', 'MK', 'MN', 'MU', 'MX', 'NA', 'NG', 'NP', 'PS', 'PY', 'RS', 'RU', 'RW', 'SA', 'SV', 'TH', 'TR', 'UA', 'UY', 'UZ', 'VE', 'VN', 'ZA' );
return apply_filters( 'woocommerce_countries_using_vat', $countries );
}
@ -409,7 +409,7 @@ class WC_Countries {
*/
public function shipping_to_prefix( $country_code = '' ) {
$country_code = $country_code ? $country_code : WC()->customer->get_shipping_country();
$countries = array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' );
$countries = array( 'AE', 'CZ', 'DO', 'GB', 'NL', 'PH', 'US', 'USAF' );
$return = in_array( $country_code, $countries, true ) ? __( 'to the', 'woocommerce' ) : __( 'to', 'woocommerce' );
return apply_filters( 'woocommerce_countries_shipping_to_prefix', $return, $country_code );
@ -423,7 +423,7 @@ class WC_Countries {
*/
public function estimated_for_prefix( $country_code = '' ) {
$country_code = $country_code ? $country_code : $this->get_base_country();
$countries = array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' );
$countries = array( 'AE', 'CZ', 'DO', 'GB', 'NL', 'PH', 'US', 'USAF' );
$return = in_array( $country_code, $countries, true ) ? __( 'the', 'woocommerce' ) . ' ' : '';
return apply_filters( 'woocommerce_countries_estimated_for_prefix', $return, $country_code );
@ -510,8 +510,8 @@ class WC_Countries {
'woocommerce_localisation_address_formats',
array(
'default' => "{name}\n{company}\n{address_1}\n{address_2}\n{city}\n{state}\n{postcode}\n{country}",
'AU' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}",
'AT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'AU' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {state} {postcode}\n{country}",
'BE' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'CA' => "{company}\n{name}\n{address_1}\n{address_2}\n{city} {state_code} {postcode}\n{country}",
'CH' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
@ -519,9 +519,10 @@ class WC_Countries {
'CN' => "{country} {postcode}\n{state}, {city}, {address_2}, {address_1}\n{company}\n{name}",
'CZ' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'DE' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'EE' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'FI' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'DK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'EE' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'ES' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{state}\n{country}",
'FI' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'FR' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city_upper}\n{country}",
'HK' => "{company}\n{first_name} {last_name_upper}\n{address_1}\n{address_2}\n{city_upper}\n{state_upper}\n{country}",
'HU' => "{last_name} {first_name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}",
@ -530,20 +531,19 @@ class WC_Countries {
'IT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode}\n{city}\n{state_upper}\n{country}",
'JM' => "{name}\n{company}\n{address_1}\n{address_2}\n{city}\n{state}\n{postcode_upper}\n{country}",
'JP' => "{postcode}\n{state} {city} {address_1}\n{address_2}\n{company}\n{last_name} {first_name}\n{country}",
'TW' => "{company}\n{last_name} {first_name}\n{address_1}\n{address_2}\n{state}, {city} {postcode}\n{country}",
'LI' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'NL' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}",
'NO' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}",
'PL' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'PR' => "{company}\n{name}\n{address_1} {address_2}\n{city} \n{country} {postcode}",
'PT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'SK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'RS' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'SI' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'ES' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{state}\n{country}",
'SE' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'SI' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'SK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'TR' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city} {state}\n{country}",
'TW' => "{company}\n{last_name} {first_name}\n{address_1}\n{address_2}\n{state}, {city} {postcode}\n{country}",
'UG' => "{name}\n{company}\n{address_1}\n{address_2}\n{city}\n{state}, {country}",
'US' => "{name}\n{company}\n{address_1}\n{address_2}\n{city}, {state_code} {postcode}\n{country}",
'VN' => "{name}\n{company}\n{address_1}\n{city}\n{country}",
@ -937,6 +937,15 @@ class WC_Countries {
'required' => false,
),
),
'CW' => array(
'postcode' => array(
'required' => false,
'hidden' => true,
),
'state' => array(
'required' => false,
),
),
'CZ' => array(
'state' => array(
'required' => false,

View File

@ -619,9 +619,11 @@ class WC_Install {
add_option( 'woocommerce_checkout_highlight_required_fields', 'yes', '', 'yes' );
add_option( 'woocommerce_demo_store', 'no', '', 'no' );
// Define initial tax classes.
WC_Tax::create_tax_class( __( 'Reduced rate', 'woocommerce' ) );
WC_Tax::create_tax_class( __( 'Zero rate', 'woocommerce' ) );
if ( self::is_new_install() ) {
// Define initial tax classes.
WC_Tax::create_tax_class( __( 'Reduced rate', 'woocommerce' ) );
WC_Tax::create_tax_class( __( 'Zero rate', 'woocommerce' ) );
}
}
/**
@ -1332,7 +1334,12 @@ CREATE TABLE {$wpdb->prefix}wc_reserved_stock (
'post_content' => '',
'post_status' => 'inherit',
);
$attach_id = wp_insert_attachment( $attachment, $filename );
$attach_id = wp_insert_attachment( $attachment, $filename );
if ( is_wp_error( $attach_id ) ) {
update_option( 'woocommerce_placeholder_image', 0 );
return;
}
update_option( 'woocommerce_placeholder_image', $attach_id );

View File

@ -92,19 +92,22 @@ class WC_Post_Types {
'update_count_callback' => '_wc_term_recount',
'label' => __( 'Categories', 'woocommerce' ),
'labels' => array(
'name' => __( 'Product categories', 'woocommerce' ),
'singular_name' => __( 'Category', 'woocommerce' ),
'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ),
'search_items' => __( 'Search categories', 'woocommerce' ),
'all_items' => __( 'All categories', 'woocommerce' ),
'parent_item' => __( 'Parent category', 'woocommerce' ),
'parent_item_colon' => __( 'Parent category:', 'woocommerce' ),
'edit_item' => __( 'Edit category', 'woocommerce' ),
'update_item' => __( 'Update category', 'woocommerce' ),
'add_new_item' => __( 'Add new category', 'woocommerce' ),
'new_item_name' => __( 'New category name', 'woocommerce' ),
'not_found' => __( 'No categories found', 'woocommerce' ),
'name' => __( 'Product categories', 'woocommerce' ),
'singular_name' => __( 'Category', 'woocommerce' ),
'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ),
'search_items' => __( 'Search categories', 'woocommerce' ),
'all_items' => __( 'All categories', 'woocommerce' ),
'parent_item' => __( 'Parent category', 'woocommerce' ),
'parent_item_colon' => __( 'Parent category:', 'woocommerce' ),
'edit_item' => __( 'Edit category', 'woocommerce' ),
'update_item' => __( 'Update category', 'woocommerce' ),
'add_new_item' => __( 'Add new category', 'woocommerce' ),
'new_item_name' => __( 'New category name', 'woocommerce' ),
'not_found' => __( 'No categories found', 'woocommerce' ),
'item_link' => __( 'Product Category Link', 'woocommerce' ),
'item_link_description' => __( 'A link to a product category.', 'woocommerce' ),
),
'show_in_rest' => true,
'show_ui' => true,
'query_var' => true,
'capabilities' => array(
@ -146,7 +149,10 @@ class WC_Post_Types {
'add_or_remove_items' => __( 'Add or remove tags', 'woocommerce' ),
'choose_from_most_used' => __( 'Choose from the most used tags', 'woocommerce' ),
'not_found' => __( 'No tags found', 'woocommerce' ),
'item_link' => __( 'Product Tag Link', 'woocommerce' ),
'item_link_description' => __( 'A link to a product tag.', 'woocommerce' ),
),
'show_in_rest' => true,
'show_ui' => true,
'query_var' => true,
'capabilities' => array(
@ -335,6 +341,8 @@ class WC_Post_Types {
'filter_items_list' => __( 'Filter products', 'woocommerce' ),
'items_list_navigation' => __( 'Products navigation', 'woocommerce' ),
'items_list' => __( 'Products list', 'woocommerce' ),
'item_link' => __( 'Product Link', 'woocommerce' ),
'item_link_description' => __( 'A link to a product.', 'woocommerce' ),
),
'description' => __( 'This is where you can add new products to your store.', 'woocommerce' ),
'public' => true,

View File

@ -355,122 +355,170 @@ class WC_Tracker {
}
/**
* Get all order data.
* Get order counts.
*
* @return array
*/
private static function get_order_counts() {
$order_count = array();
$order_count_data = wp_count_posts( 'shop_order' );
foreach ( wc_get_order_statuses() as $status_slug => $status_name ) {
$order_count[ $status_slug ] = $order_count_data->{ $status_slug };
}
return $order_count;
}
/**
* Combine all order data.
*
* @return array
*/
private static function get_orders() {
$args = array(
'type' => array( 'shop_order', 'shop_order_refund' ),
'limit' => get_option( 'posts_per_page' ),
'paged' => 1,
$order_dates = self::get_order_dates();
$order_counts = self::get_order_counts();
$order_totals = self::get_order_totals();
$order_gateways = self::get_orders_by_gateway();
return array_merge( $order_dates, $order_counts, $order_totals, $order_gateways );
}
/**
* Get order totals.
*
* @since 5.4.0
* @return array
*/
private static function get_order_totals() {
global $wpdb;
$gross_total = $wpdb->get_var(
"
SELECT
SUM( order_meta.meta_value ) AS 'gross_total'
FROM {$wpdb->prefix}posts AS orders
LEFT JOIN {$wpdb->prefix}postmeta AS order_meta ON order_meta.post_id = orders.ID
WHERE order_meta.meta_key = '_order_total'
AND orders.post_status in ( 'wc-completed', 'wc-refunded' )
GROUP BY order_meta.meta_key
"
);
$first = time();
$processing_first = $first;
$first_time = $first;
$last = 0;
$processing_last = 0;
$order_data = array();
$orders = wc_get_orders( $args );
$orders_count = count( $orders );
while ( $orders_count ) {
foreach ( $orders as $order ) {
$date_created = (int) $order->get_date_created()->getTimestamp();
$type = $order->get_type();
$status = $order->get_status();
if ( 'shop_order' == $type ) {
// Find the first and last order dates for completed and processing statuses.
if ( 'completed' == $status && $date_created < $first ) {
$first = $date_created;
}
if ( 'completed' == $status && $date_created > $last ) {
$last = $date_created;
}
if ( 'processing' == $status && $date_created < $processing_first ) {
$processing_first = $date_created;
}
if ( 'processing' == $status && $date_created > $processing_last ) {
$processing_last = $date_created;
}
// Get order counts by status.
$status = 'wc-' . $status;
if ( ! isset( $order_data[ $status ] ) ) {
$order_data[ $status ] = 1;
} else {
$order_data[ $status ] += 1;
}
// Count number of orders by gateway used.
$gateway = $order->get_payment_method();
if ( ! empty( $gateway ) && in_array( $status, array( 'wc-completed', 'wc-refunded', 'wc-processing' ) ) ) {
$gateway = 'gateway_' . $gateway;
if ( ! isset( $order_data[ $gateway ] ) ) {
$order_data[ $gateway ] = 1;
} else {
$order_data[ $gateway ] += 1;
}
}
} else {
// If it is a refunded order (shop_order_refunnd type), add the prefix as this prefix gets
// added midway in the if clause.
$status = 'wc-' . $status;
}
// Calculate the gross total for 'completed' and 'processing' orders.
$total = $order->get_total();
if ( in_array( $status, array( 'wc-completed', 'wc-refunded' ) ) ) {
if ( ! isset( $order_data['gross'] ) ) {
$order_data['gross'] = $total;
} else {
$order_data['gross'] += $total;
}
} elseif ( 'wc-processing' == $status ) {
if ( ! isset( $order_data['processing_gross'] ) ) {
$order_data['processing_gross'] = $total;
} else {
$order_data['processing_gross'] += $total;
}
}
}
$args['paged']++;
$orders = wc_get_orders( $args );
$orders_count = count( $orders );
if ( is_null( $gross_total ) ) {
$gross_total = 0;
}
if ( $first !== $first_time ) {
$order_data['first'] = gmdate( 'Y-m-d H:i:s', $first );
$processing_gross_total = $wpdb->get_var(
"
SELECT
SUM( order_meta.meta_value ) AS 'gross_total'
FROM {$wpdb->prefix}posts AS orders
LEFT JOIN {$wpdb->prefix}postmeta AS order_meta ON order_meta.post_id = orders.ID
WHERE order_meta.meta_key = '_order_total'
AND orders.post_status = 'wc-processing'
GROUP BY order_meta.meta_key
"
);
if ( is_null( $processing_gross_total ) ) {
$processing_gross_total = 0;
}
if ( $processing_first !== $first_time ) {
$order_data['processing_first'] = gmdate( 'Y-m-d H:i:s', $processing_first );
return array(
'gross' => $gross_total,
'processing_gross' => $processing_gross_total,
);
}
/**
* Get last order date.
*
* @return string
*/
private static function get_order_dates() {
global $wpdb;
$min_max = $wpdb->get_row(
"
SELECT
MIN( post_date_gmt ) as 'first', MAX( post_date_gmt ) as 'last'
FROM {$wpdb->prefix}posts
WHERE post_type = 'shop_order'
AND post_status = 'wc-completed'
",
ARRAY_A
);
if ( is_null( $min_max ) ) {
$min_max = array(
'first' => '-',
'last' => '-',
);
}
if ( $last ) {
$order_data['last'] = gmdate( 'Y-m-d H:i:s', $last );
$processing_min_max = $wpdb->get_row(
"
SELECT
MIN( post_date_gmt ) as 'processing_first', MAX( post_date_gmt ) as 'processing_last'
FROM {$wpdb->prefix}posts
WHERE post_type = 'shop_order'
AND post_status = 'wc-processing'
",
ARRAY_A
);
if ( is_null( $processing_min_max ) ) {
$processing_min_max = array(
'processing_first' => '-',
'processing_last' => '-',
);
}
if ( $processing_last ) {
$order_data['processing_last'] = gmdate( 'Y-m-d H:i:s', $processing_last );
return array_merge( $min_max, $processing_min_max );
}
/**
* Get order details by gateway.
*
* @return array
*/
private static function get_orders_by_gateway() {
global $wpdb;
$orders_by_gateway = $wpdb->get_results(
"
SELECT
gateway, currency, SUM(total) AS totals, COUNT(order_id) AS counts
FROM (
SELECT
orders.id AS order_id,
MAX(CASE WHEN meta_key = '_payment_method' THEN meta_value END) gateway,
MAX(CASE WHEN meta_key = '_order_total' THEN meta_value END) total,
MAX(CASE WHEN meta_key = '_order_currency' THEN meta_value END) currency
FROM
{$wpdb->prefix}posts orders
LEFT JOIN
{$wpdb->prefix}postmeta order_meta ON order_meta.post_id = orders.id
WHERE orders.post_type = 'shop_order'
AND orders.post_status in ( 'wc-completed', 'wc-processing', 'wc-refunded' )
AND meta_key in( '_payment_method','_order_total','_order_currency')
GROUP BY orders.id
) order_gateways
GROUP BY gateway, currency
"
);
$orders_by_gateway_currency = array();
foreach ( $orders_by_gateway as $orders_details ) {
$gateway = 'gateway_' . $orders_details->gateway;
$currency = $orders_details->currency;
$count = $gateway . '_' . $currency . '_count';
$total = $gateway . '_' . $currency . '_total';
$orders_by_gateway_currency[ $count ] = $orders_details->counts;
$orders_by_gateway_currency[ $total ] = $orders_details->totals;
}
foreach ( $order_data as $key => $value ) {
$order_data[ $key ] = (string) $value;
}
return $order_data;
return $orders_by_gateway_currency;
}
/**
@ -635,17 +683,6 @@ class WC_Tracker {
return array_filter( (array) get_option( 'woocommerce_tracker_ua', array() ) );
}
/**
* Get order totals
*
* @deprecated 5.1.0 Logic moved to get_orders.
* @return array
*/
public static function get_order_totals() {
wc_deprecated_function( 'WC_Tracker::get_order_totals', '5.1.0', '' );
return self::get_orders();
}
/**
* Search a specific post for text content.
*

View File

@ -9,7 +9,9 @@
defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Internal\DownloadPermissionsAdjuster;
use Automattic\WooCommerce\Internal\RestockRefundedItemsAdjuster;
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\DataRegenerator;
use Automattic\WooCommerce\Proxies\LegacyProxy;
/**
@ -24,7 +26,7 @@ final class WooCommerce {
*
* @var string
*/
public $version = '5.3.0';
public $version = '5.5.0';
/**
* WooCommerce Schema version.
@ -204,13 +206,27 @@ final class WooCommerce {
add_action( 'switch_blog', array( $this, 'wpdb_table_fix' ), 0 );
add_action( 'activated_plugin', array( $this, 'activated_plugin' ) );
add_action( 'deactivated_plugin', array( $this, 'deactivated_plugin' ) );
add_filter( 'woocommerce_rest_prepare_note', array( 'WC_Admin_Notices', 'prepare_note_with_nonce' ) );
add_action( 'woocommerce_installed', array( $this, 'add_woocommerce_inbox_variant' ) );
add_action( 'woocommerce_updated', array( $this, 'add_woocommerce_inbox_variant' ) );
// These classes set up hooks on instantiation.
wc_get_container()->get( DownloadPermissionsAdjuster::class );
wc_get_container()->get( AssignDefaultCategory::class );
wc_get_container()->get( DataRegenerator::class );
wc_get_container()->get( RestockRefundedItemsAdjuster::class );
}
/**
* Add woocommerce_inbox_variant for the Remote Inbox Notification.
*
* P2 post can be found at https://wp.me/paJDYF-1uJ.
*/
public function add_woocommerce_inbox_variant() {
$config_name = 'woocommerce_inbox_variant_assignment';
if ( false === get_option( $config_name, false ) ) {
update_option( $config_name, wp_rand( 1, 12 ) );
}
}
/**
* Ensures fatal errors are logged so they can be picked up in the status report.
*

View File

@ -6,8 +6,6 @@
* @package WooCommerce
*/
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
/**
@ -15,19 +13,10 @@ defined( 'ABSPATH' ) || exit;
*/
class WC_Shop_Customizer {
/**
* Holds the instance of ThemeSupport to use.
*
* @var ThemeSupport $theme_support The instance of ThemeSupport to use.
*/
private $theme_support;
/**
* Constructor.
*/
public function __construct() {
$this->theme_support = wc_get_container()->get( ThemeSupport::class );
add_action( 'customize_register', array( $this, 'add_sections' ) );
add_action( 'customize_controls_print_styles', array( $this, 'add_styles' ) );
add_action( 'customize_controls_print_scripts', array( $this, 'add_scripts' ), 30 );
@ -128,7 +117,7 @@ class WC_Shop_Customizer {
} );
wp.customize.bind( 'ready', function() { // Ready?
$( '.woocommerce-cropping-control' ).find( 'input:checked' ).change();
$( '.woocommerce-cropping-control' ).find( 'input:checked' ).trigger( 'change' );
} );
wp.customize( 'woocommerce_demo_store', function( setting ) {
@ -556,11 +545,11 @@ class WC_Shop_Customizer {
)
);
if ( ! $this->theme_support->has_option( 'single_image_width', false ) ) {
if ( ! wc_get_theme_support( 'single_image_width' ) ) {
$wp_customize->add_setting(
'woocommerce_single_image_width',
array(
'default' => $this->theme_support->get_option( 'single_image_width', 600 ),
'default' => 600,
'type' => 'option',
'capability' => 'manage_woocommerce',
'sanitize_callback' => 'absint',
@ -584,11 +573,11 @@ class WC_Shop_Customizer {
);
}
if ( ! $this->theme_support->has_option( 'thumbnail_image_width', false ) ) {
if ( ! wc_get_theme_support( 'thumbnail_image_width' ) ) {
$wp_customize->add_setting(
'woocommerce_thumbnail_image_width',
array(
'default' => $this->theme_support->get_option( 'thumbnail_image_width', 300 ),
'default' => 300,
'type' => 'option',
'capability' => 'manage_woocommerce',
'sanitize_callback' => 'absint',

View File

@ -600,7 +600,8 @@ class WC_Email extends WC_Settings_API {
* @return string
*/
public function get_content_plain() {
return ''; }
return '';
}
/**
* Get the email content in HTML format.
@ -608,7 +609,8 @@ class WC_Email extends WC_Settings_API {
* @return string
*/
public function get_content_html() {
return ''; }
return '';
}
/**
* Get the from name for outgoing emails.
@ -1029,7 +1031,7 @@ class WC_Email extends WC_Settings_API {
<?php
wc_enqueue_js(
"jQuery( 'select.email_type' ).change( function() {
"jQuery( 'select.email_type' ).on( 'change', function() {
var val = jQuery( this ).val();
@ -1043,7 +1045,7 @@ class WC_Email extends WC_Settings_API {
jQuery('.template_plain').hide();
}
}).change();
}).trigger( 'change' );
var view = '" . esc_js( __( 'View template', 'woocommerce' ) ) . "';
var hide = '" . esc_js( __( 'Hide template', 'woocommerce' ) ) . "';
@ -1067,7 +1069,7 @@ class WC_Email extends WC_Settings_API {
return false;
});
jQuery( '.editor textarea' ).change( function() {
jQuery( '.editor textarea' ).on( 'change', function() {
var name = jQuery( this ).attr( 'data-name' );
if ( name ) {

View File

@ -38,7 +38,7 @@ jQuery( function( $ ) {
}
} );
$( '#woocommerce_paypal_testmode' ).change();
$( '#woocommerce_paypal_testmode' ).trigger( 'change' );
}
};

View File

@ -58,7 +58,7 @@ return array(
'description' => sprintf( __( 'Log PayPal events, such as IPN requests, inside %s Note: this may log personal information. We recommend using this for debugging purposes only and deleting the logs when finished.', 'woocommerce' ), '<code>' . WC_Log_Handler_File::get_log_file_path( 'paypal' ) . '</code>' ),
),
'ipn_notification' => array(
'title' => __( 'IPN Email Notifications', 'woocommerce' ),
'title' => __( 'IPN email notifications', 'woocommerce' ),
'type' => 'checkbox',
'label' => __( 'Enable IPN email notifications', 'woocommerce' ),
'default' => 'yes',

View File

@ -640,7 +640,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller {
*
* TODO: Refactor to fix this behavior when DI gets included to make it obvious and clean.
*/
$request = func_num_args() >= 2 ? func_get_arg( 2 ) : new WP_REST_Request( '', '', array( 'context' => $context ) );
$request = func_num_args() >= 3 ? func_get_arg( 2 ) : new WP_REST_Request( '', '', array( 'context' => $context ) );
$fields = $this->get_fields_for_response( $request );
$base_data = array();

View File

@ -143,7 +143,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
'button' => __( 'Clean up download permissions', 'woocommerce' ),
'desc' => __( 'This tool will delete expired download permissions and permissions with 0 remaining downloads.', 'woocommerce' ),
),
'regenerate_product_lookup_tables' => array(
'regenerate_product_lookup_tables' => array(
'name' => __( 'Product lookup tables', 'woocommerce' ),
'button' => __( 'Regenerate', 'woocommerce' ),
'desc' => __( 'This tool will regenerate product lookup table data. This process may take a while.', 'woocommerce' ),
@ -552,14 +552,14 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
$message = __( 'Template cache cleared.', 'woocommerce' );
} else {
$message = __( 'The active version of WooCommerce does not support template cache clearing.', 'woocommerce' );
$ran = false;
$ran = false;
}
break;
case 'verify_db_tables':
if ( ! method_exists( 'WC_Install', 'verify_base_tables' ) ) {
$message = __( 'You need WooCommerce 4.2 or newer to run this tool.', 'woocommerce' );
$ran = false;
$ran = false;
break;
}
// Try to manually create table again.
@ -567,9 +567,9 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
if ( 0 === count( $missing_tables ) ) {
$message = __( 'Database verified successfully.', 'woocommerce' );
} else {
$message = __( 'Verifying database... One or more tables are still missing: ', 'woocommerce' );
$message = __( 'Verifying database... One or more tables are still missing: ', 'woocommerce' );
$message .= implode( ', ', $missing_tables );
$ran = false;
$ran = false;
}
break;
@ -577,11 +577,35 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
$tools = $this->get_tools();
if ( isset( $tools[ $tool ]['callback'] ) ) {
$callback = $tools[ $tool ]['callback'];
$return = call_user_func( $callback );
if ( is_string( $return ) ) {
try {
$return = call_user_func( $callback );
} catch ( Exception $exception ) {
$return = $exception;
}
if ( is_a( $return, Exception::class ) ) {
$callback_string = $this->get_printable_callback_name( $callback, $tool );
$ran = false;
/* translators: %1$s: callback string, %2$s: error message */
$message = sprintf( __( 'There was an error calling %1$s: %2$s', 'woocommerce' ), $callback_string, $return->getMessage() );
$logger = wc_get_logger();
$logger->error(
sprintf(
'Error running debug tool %s: %s',
$tool,
$return->getMessage()
),
array(
'source' => 'run-debug-tool',
'tool' => $tool,
'callback' => $callback,
'error' => $return,
)
);
} elseif ( is_string( $return ) ) {
$message = $return;
} elseif ( false === $return ) {
$callback_string = is_array( $callback ) ? get_class( $callback[0] ) . '::' . $callback[1] : $callback;
$callback_string = $this->get_printable_callback_name( $callback, $tool );
$ran = false;
/* translators: %s: callback string */
$message = sprintf( __( 'There was an error calling %s', 'woocommerce' ), $callback_string );
@ -600,4 +624,22 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
'message' => $message,
);
}
/**
* Get a printable name for a callback.
*
* @param mixed $callback The callback to get a name for.
* @param string $default The default name, to be returned when the callback is an inline function.
* @return string A printable name for the callback.
*/
private function get_printable_callback_name( $callback, $default ) {
if ( is_array( $callback ) ) {
return get_class( $callback[0] ) . '::' . $callback[1];
}
if ( is_string( $callback ) ) {
return $callback;
}
return $default;
}
}

View File

@ -300,6 +300,13 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
$args['date_query'][0]['after'] = $request['after'];
}
// Check flag to use post_date vs post_date_gmt.
if ( true === $request['dates_are_gmt'] ) {
if ( isset( $request['before'] ) || isset( $request['after'] ) ) {
$args['date_query'][0]['column'] = 'post_date_gmt';
}
}
// Force the post_type argument, since it's not a user input variable.
$args['post_type'] = $this->post_type;
@ -562,6 +569,12 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg',
);
$params['dates_are_gmt'] = array(
'description' => __( 'Whether to use GMT post dates.', 'woocommerce' ),
'type' => 'boolean',
'default' => false,
'validate_callback' => 'rest_validate_request_arg',
);
$params['exclude'] = array(
'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
'type' => 'array',

View File

@ -233,7 +233,7 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
});
// Change while load.
$( '#woocommerce_free_shipping_requires' ).change();
$( '#woocommerce_free_shipping_requires' ).trigger( 'change' );
$( document.body ).on( 'wc_backbone_modal_loaded', function( evt, target ) {
if ( 'wc-modal-shipping-method-settings' === target ) {
wcFreeShippingShowHideMinAmountField( $( '#wc-backbone-modal-dialog #woocommerce_free_shipping_requires', evt.currentTarget ) );

View File

@ -6,8 +6,6 @@
* @package WooCommerce\Classes
*/
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
/**
@ -31,7 +29,8 @@ class WC_Twenty_Eleven {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
wc_get_container()->get( ThemeSupport::class )->add_default_options(
add_theme_support(
'woocommerce',
array(
'thumbnail_image_width' => 150,
'single_image_width' => 300,

View File

@ -7,8 +7,6 @@
* @package WooCommerce\Classes
*/
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
/**
@ -32,7 +30,8 @@ class WC_Twenty_Fifteen {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
wc_get_container()->get( ThemeSupport::class )->add_default_options(
add_theme_support(
'woocommerce',
array(
'thumbnail_image_width' => 200,
'single_image_width' => 350,

View File

@ -7,8 +7,6 @@
* @package WooCommerce\Classes
*/
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
/**
@ -32,7 +30,8 @@ class WC_Twenty_Fourteen {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
wc_get_container()->get( ThemeSupport::class )->add_default_options(
add_theme_support(
'woocommerce',
array(
'thumbnail_image_width' => 150,
'single_image_width' => 300,

View File

@ -7,7 +7,6 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
@ -38,7 +37,8 @@ class WC_Twenty_Nineteen {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
wc_get_container()->get( ThemeSupport::class )->add_default_options(
add_theme_support(
'woocommerce',
array(
'thumbnail_image_width' => 300,
'single_image_width' => 450,

View File

@ -7,7 +7,6 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
@ -31,7 +30,8 @@ class WC_Twenty_Seventeen {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
wc_get_container()->get( ThemeSupport::class )->add_default_options(
add_theme_support(
'woocommerce',
array(
'thumbnail_image_width' => 250,
'single_image_width' => 350,

View File

@ -6,8 +6,6 @@
* @package WooCommerce\Classes
*/
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
/**
@ -31,7 +29,8 @@ class WC_Twenty_Sixteen {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
wc_get_container()->get( ThemeSupport::class )->add_default_options(
add_theme_support(
'woocommerce',
array(
'thumbnail_image_width' => 250,
'single_image_width' => 400,

View File

@ -6,8 +6,6 @@
* @package WooCommerce\Classes
*/
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
/**
@ -31,7 +29,8 @@ class WC_Twenty_Ten {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
wc_get_container()->get( ThemeSupport::class )->add_default_options(
add_theme_support(
'woocommerce',
array(
'thumbnail_image_width' => 200,
'single_image_width' => 300,

View File

@ -7,8 +7,6 @@
* @package WooCommerce\Classes
*/
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
/**
@ -32,7 +30,8 @@ class WC_Twenty_Thirteen {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
wc_get_container()->get( ThemeSupport::class )->add_default_options(
add_theme_support(
'woocommerce',
array(
'thumbnail_image_width' => 200,
'single_image_width' => 300,

Some files were not shown because too many files have changed in this diff Show More