Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security fix: Backport security fixes from WC 3.5.8 #230

Merged
merged 7 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions assets/js/admin/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ jQuery( function ( $ ) {
$parent = $state.parent(),
input_name = $state.attr( 'name' ),
input_id = $state.attr( 'id' ),
value = $this.data( 'woocommerce.stickState-' + country ) ? $this.data( 'woocommerce.stickState-' + country ) : $state.val();
stickstatefield = 'woocommerce.stickState-' + country,
value = $this.data( stickstatefield ) ? $this.data( stickstatefield ) : $state.val(),
placeholder = $state.attr( 'placeholder' ),
$newstate;

if ( stickValue ){
$this.data( 'woocommerce.stickState-' + country, value );
Expand All @@ -46,22 +49,37 @@ jQuery( function ( $ ) {
$parent.show().find( '.select2-container' ).remove();

if ( ! $.isEmptyObject( wc_users_fields.states[ country ] ) ) {
var $states_select = $( '<select name="' + input_name + '" id="' + input_id + '" class="js_field-state" style="width: 25em;"></select>' ),
state = wc_users_fields.states[ country ];
var state = wc_users_fields.states[ country ],
$defaultOption = $( '<option value=""></option>' )
.text( wc_users_fields.i18n_select_state_text );

$states_select.append( $( '<option value="">' + wc_users_params.i18n_select_state_text + '</option>' ) );
$newstate = $( '<select style="width: 25em;"></select>' )
.prop( 'id', input_id )
.prop( 'name', input_name )
.prop( 'placeholder', placeholder )
.addClass( 'js_field-state' )
.append( $defaultOption );

$.each( state, function( index ) {
$states_select.append( $( '<option value="' + index + '">' + state[ index ] + '</option>' ) );
var $option = $( '<option></option>' )
.prop( 'value', index )
.text( state[ index ] );
$newstate.append( $option );
} );

$states_select.val( value );
$newstate.val( value );

$state.replaceWith( $states_select );
$state.replaceWith( $newstate );

$states_select.show().selectWoo().hide().change();
$newstate.show().selectWoo().hide().change();
} else {
$state.replaceWith( '<input type="text" class="js_field-state" name="' + input_name + '" id="' + input_id + '" value="' + value + '" />' );
$newstate = $( '<input type="text" />' )
.prop( 'id', input_id )
.prop( 'name', input_name )
.prop( 'placeholder', placeholder )
.addClass( 'js_field-state regular-text' )
.val( value );
$state.replaceWith( $newstate );
}

// This event has a typo - deprecated in 2.5.0
Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin/users.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion assets/js/frontend/single-product.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,15 @@ jQuery( function( $ ) {
}

var options = $.extend( {
index: $( clicked ).index()
index: $( clicked ).index(),
addCaptionHTMLFn: function( item, captionEl ) {
if ( ! item.title ) {
captionEl.children[0].textContent = '';
return false;
}
captionEl.children[0].textContent = item.title;
return true;
}
}, wc_single_product_params.photoswipe_options );

// Initializes and opens PhotoSwipe.
Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/single-product.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions assets/js/selectWoo/selectWoo.full.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* SelectWoo 1.0.1
* SelectWoo 1.0.5
* https://github.com/woocommerce/selectWoo
*
* Released under the MIT license
Expand Down Expand Up @@ -1613,7 +1613,7 @@ S2.define('select2/selection/single',[
var $rendered = this.$selection.find('.select2-selection__rendered');
var formatted = this.display(selection, $rendered);

$rendered.empty().append(formatted);
$rendered.empty().text(formatted);
$rendered.prop('title', selection.title || selection.text);
};

Expand Down Expand Up @@ -1924,7 +1924,7 @@ S2.define('select2/selection/search',[
var $search = $(
'<li class="select2-search select2-search--inline">' +
'<input class="select2-search__field" type="text" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
'</li>'
);
Expand Down Expand Up @@ -3992,7 +3992,7 @@ S2.define('select2/dropdown/search',[
var $search = $(
'<span class="select2-search select2-search--dropdown">' +
'<input class="select2-search__field" type="text" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
' spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" />' +
'</span>'
);
Expand Down Expand Up @@ -4047,7 +4047,7 @@ S2.define('select2/dropdown/search',[
});

container.on('focus', function () {
if (container.isOpen()) {
if (!container.isOpen()) {
self.$search.focus();
}
});
Expand Down
2 changes: 1 addition & 1 deletion assets/js/selectWoo/selectWoo.full.min.js

Large diffs are not rendered by default.

Loading