diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 0b2b6d163ee..a98f292be23 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -5,6 +5,7 @@ filter: - dummy-data/* - i18n/* - includes/api/v1/* + - includes/api/v2/* - includes/libraries/* - includes/updates/* - includes/gateways/simplify-commerce/includes/* @@ -25,4 +26,4 @@ checks: avoid_closing_tag: false tools: - sensiolabs_security_checker: true \ No newline at end of file + sensiolabs_security_checker: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b123301293e..89419b09e34 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ GitHub is for *bug reports and contributions only* - if you have a support quest * When committing, reference your issue (#1234) and include a note about the fix. * Push the changes to your fork and submit a pull request on the master branch of the WooCommerce repository. Existing maintenance branches will be maintained of by WooCommerce developers. * Please **don't** modify the changelog - this will be maintained by the WooCommerce developers. -* Please **don't** add your localizations or update the .pot files - this will be maintanied by the WooCommerce developers. To contribute to the localization of WooCommerce, please join the [WooCommerce Transifex project](https://www.transifex.com/projects/p/woocommerce/). +* Please **don't** add your localizations or update the .pot files - this will be maintained by the WooCommerce developers. To contribute to the localization of WooCommerce, please join the [WooCommerce Transifex project](https://www.transifex.com/projects/p/woocommerce/). At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary. diff --git a/Gruntfile.js b/Gruntfile.js index 894b9e3b1e2..bb74d43371d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -65,6 +65,7 @@ module.exports = function( grunt ) { '<%= dirs.js %>/jquery-cookie/jquery.cookie.min.js': ['<%= dirs.js %>/jquery-cookie/jquery.cookie.js'], '<%= dirs.js %>/jquery-payment/jquery.payment.min.js': ['<%= dirs.js %>/jquery-payment/jquery.payment.js'], '<%= dirs.js %>/jquery-qrcode/jquery.qrcode.min.js': ['<%= dirs.js %>/jquery-qrcode/jquery.qrcode.js'], + '<%= dirs.js %>/jquery-serializejson/jquery.serializejson.min.js': ['<%= dirs.js %>/jquery-serializejson/jquery.serializejson.js'], '<%= dirs.js %>/jquery-tiptip/jquery.tipTip.min.js': ['<%= dirs.js %>/jquery-tiptip/jquery.tipTip.js'], '<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.init.min.js': ['<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.init.js'], '<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.min.js': ['<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.js'], diff --git a/assets/js/admin/meta-boxes-product-variation.js b/assets/js/admin/meta-boxes-product-variation.js index d0e7452e34e..f05ef18c25b 100644 --- a/assets/js/admin/meta-boxes-product-variation.js +++ b/assets/js/admin/meta-boxes-product-variation.js @@ -18,6 +18,8 @@ jQuery( function( $ ) { $( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock' ).change(); $( '#woocommerce-product-data' ).on( 'woocommerce_variations_loaded', this.variations_loaded ); + + $( document.body ).on( 'woocommerce_variations_added', this.variation_added ); }, /** @@ -57,11 +59,13 @@ jQuery( function( $ ) { * Run actions when variations is loaded */ variations_loaded: function() { + var wrapper = $( '#woocommerce-product-data' ); + // Show/hide downloadable, virtual and stock fields - $( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock', $( this ) ).change(); + $( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock', wrapper ).change(); // Open sale schedule fields when have some sale price date - $( '.woocommerce_variation', $( this ) ).each( function( index, el ) { + $( '.woocommerce_variation', wrapper ).each( function( index, el ) { var $el = $( el ), date_from = $( '.sale_price_dates_from', $el ).val(), date_to = $( '.sale_price_dates_to', $el ).val(); @@ -72,15 +76,15 @@ jQuery( function( $ ) { }); // Remove variation-needs-update classes - $( '.woocommerce_variations .variation-needs-update', $( this ) ).removeClass( 'variation-needs-update' ); + $( '.woocommerce_variations .variation-needs-update', wrapper ).removeClass( 'variation-needs-update' ); // Disable cancel and save buttons - $( 'button.cancel-variation-changes, button.save-variation-changes', $( this ) ).attr( 'disabled', 'disabled' ); + $( 'button.cancel-variation-changes, button.save-variation-changes', wrapper ).attr( 'disabled', 'disabled' ); // Init TipTip $( '#tiptip_holder' ).removeAttr( 'style' ); $( '#tiptip_arrow' ).removeAttr( 'style' ); - $( '.woocommerce_variations .tips', $( this ) ).tipTip({ + $( '.woocommerce_variations .tips', wrapper ).tipTip({ 'attribute': 'data-tip', 'fadeIn': 50, 'fadeOut': 50, @@ -88,7 +92,7 @@ jQuery( function( $ ) { }); // Datepicker fields - $( '.sale_price_dates_fields', $( this ) ).each( function() { + $( '.sale_price_dates_fields', wrapper ).each( function() { var dates = $( this ).find( 'input' ).datepicker({ defaultDate: '', dateFormat: 'yy-mm-dd', @@ -106,6 +110,18 @@ jQuery( function( $ ) { }); $( document.body ).trigger( 'wc-enhanced-select-init' ); + }, + + /** + * Run actions when added a variation + * + * @param {Object} event [description] + * @param {Int} qty + */ + variation_added: function( event, qty ) { + if ( 1 === qty ) { + wc_meta_boxes_product_variations_actions.variations_loaded(); + } } }; @@ -117,28 +133,28 @@ jQuery( function( $ ) { /** * wp.media frame object * - * @type {object} + * @type {Object} */ variable_image_frame: null, /** * Variation image ID * - * @type {int} + * @type {Int} */ setting_variation_image_id: null, /** * Variation image object * - * @type {object} + * @type {Object} */ setting_variation_image: null, /** * wp.media post ID * - * @type {int} + * @type {Int} */ wp_media_post_id: wp.media.model.settings.post.id, @@ -153,7 +169,7 @@ jQuery( function( $ ) { /** * Added new image * - * @param {object} event + * @param {Object} event */ add_image: function( event ) { var $button = $( this ), @@ -251,7 +267,7 @@ jQuery( function( $ ) { /** * Check if have some changes before leave the page * - * @return {bool} + * @return {Bool} */ check_for_changes: function() { var need_update = $( '#variable_product_options .woocommerce_variations .variation-needs-update' ); @@ -291,7 +307,7 @@ jQuery( function( $ ) { /** * Initial load variations * - * @return {bool} + * @return {Bool} */ initial_load: function() { if ( 0 === $( '#variable_product_options .woocommerce_variations .woocommerce_variation' ).length ) { @@ -302,8 +318,8 @@ jQuery( function( $ ) { /** * Load variations via Ajax * - * @param {int} page (default: 1) - * @param {int} per_page (default: 10) + * @param {Int} page (default: 1) + * @param {Int} per_page (default: 10) */ load_variations: function( page, per_page ) { page = page || 1; @@ -337,31 +353,15 @@ jQuery( function( $ ) { /** * Ger variations fields and convert to object * - * @param {object} fields + * @param {Object} fields * - * @return {object} + * @return {Object} */ get_variations_fields: function( fields ) { - var data = {}, - index = 0; - - fields.each( function( i, element ) { - $.each( $( ':input', element ).serializeArray(), function( key, input ) { - var name = input.name.replace( /\[.*\]/g, '' ); - - if ( ! data.hasOwnProperty( name ) ) { - data[ name ] = {}; - } - - data[ name ][ index ] = input.value; - }); - - index++; - }); + var data = $( ':input', fields ).serializeJSON(); $( '.variations-defaults select' ).each( function( index, element ) { var select = $( element ); - data[ select.attr( 'name' ) ] = select.val(); }); @@ -411,7 +411,7 @@ jQuery( function( $ ) { /** * Save variations * - * @return {bool} + * @return {Bool} */ save_variations: function() { $( '#variable_product_options' ).trigger( 'woocommerce_variations_save_variations_button' ); @@ -441,7 +441,7 @@ jQuery( function( $ ) { /** * Discart changes. * - * @return {bool} + * @return {Bool} */ cancel_variations: function() { var current = parseInt( $( '#variable_product_options .woocommerce_variations' ).attr( 'data-page' ), 10 ); @@ -459,7 +459,7 @@ jQuery( function( $ ) { /** * Add variation * - * @return {bool} + * @return {Bool} */ add_variation: function() { wc_meta_boxes_product_variations_ajax.block(); @@ -487,7 +487,7 @@ jQuery( function( $ ) { /** * Remove variation * - * @return {bool} + * @return {Bool} */ remove_variation: function() { wc_meta_boxes_product_variations_ajax.check_for_changes(); @@ -535,7 +535,7 @@ jQuery( function( $ ) { /** * Link all variations (or at least try :p) * - * @return {bool} + * @return {Bool} */ link_all_variations: function() { wc_meta_boxes_product_variations_ajax.check_for_changes(); @@ -622,7 +622,7 @@ jQuery( function( $ ) { changes = parseInt( $( '#variable_product_options .woocommerce_variations' ).attr( 'data-total' ), 10 ) * -1; } } - break; + break; case 'variable_regular_price_increase' : case 'variable_regular_price_decrease' : case 'variable_sale_price_increase' : @@ -636,7 +636,7 @@ jQuery( function( $ ) { data.value = accounting.unformat( value, woocommerce_admin.mon_decimal_point ); } } - break; + break; case 'variable_regular_price' : case 'variable_sale_price' : case 'variable_stock' : @@ -651,7 +651,7 @@ jQuery( function( $ ) { if ( value != null ) { data.value = value; } - break; + break; case 'variable_sale_schedule' : data.date_from = window.prompt( woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_start ); data.date_to = window.prompt( woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_end ); @@ -663,13 +663,18 @@ jQuery( function( $ ) { if ( null === data.date_to ) { data.date_to = false; } - break; + break; default : $( 'select.variation_actions' ).trigger( do_variation_action ); - break; + break; + } + + if ( 'delete_all' === do_variation_action && data.allowed ) { + $( '#variable_product_options .variation-needs-update' ).removeClass( 'variation-needs-update' ); + } else { + wc_meta_boxes_product_variations_ajax.check_for_changes(); } - wc_meta_boxes_product_variations_ajax.check_for_changes(); wc_meta_boxes_product_variations_ajax.block(); $.ajax({ @@ -710,9 +715,9 @@ jQuery( function( $ ) { /** * Set variations count * - * @param {int} qty + * @param {Int} qty * - * @return {int} + * @return {Int} */ update_variations_count: function( qty ) { var wrapper = $( '#variable_product_options .woocommerce_variations' ), @@ -735,7 +740,7 @@ jQuery( function( $ ) { * Update variations quantity when add a new variation * * @param {Object} event - * @param {int} qty + * @param {Int} qty */ update_single_quantity: function( event, qty ) { if ( 1 === qty ) { @@ -756,7 +761,7 @@ jQuery( function( $ ) { /** * Set the pagenav fields * - * @param {int} qty + * @param {Int} qty */ set_paginav: function( qty ) { var wrapper = $( '#variable_product_options .woocommerce_variations' ), @@ -806,7 +811,7 @@ jQuery( function( $ ) { /** * Check button if enabled and if don't have changes * - * @return {bool} + * @return {Bool} */ check_is_enabled: function( current ) { return ! $( current ).hasClass( 'disabled' ); @@ -848,8 +853,8 @@ jQuery( function( $ ) { /** * Navigate on variations pages * - * @param {int} page - * @param {int} qty + * @param {Int} page + * @param {Int} qty */ go_to_page: function( page, qty ) { page = page || 1; @@ -874,7 +879,7 @@ jQuery( function( $ ) { /** * Go to first page * - * @return {bool} + * @return {Bool} */ first_page: function() { if ( wc_meta_boxes_product_variations_pagenav.check_is_enabled( this ) ) { @@ -887,7 +892,7 @@ jQuery( function( $ ) { /** * Go to previous page * - * @return {bool} + * @return {Bool} */ prev_page: function() { if ( wc_meta_boxes_product_variations_pagenav.check_is_enabled( this ) ) { @@ -904,7 +909,7 @@ jQuery( function( $ ) { /** * Go to next page * - * @return {bool} + * @return {Bool} */ next_page: function() { if ( wc_meta_boxes_product_variations_pagenav.check_is_enabled( this ) ) { @@ -922,7 +927,7 @@ jQuery( function( $ ) { /** * Go to last page * - * @return {bool} + * @return {Bool} */ last_page: function() { if ( wc_meta_boxes_product_variations_pagenav.check_is_enabled( this ) ) { diff --git a/assets/js/admin/meta-boxes-product-variation.min.js b/assets/js/admin/meta-boxes-product-variation.min.js index fea8ba15140..61c121a9f7e 100644 --- a/assets/js/admin/meta-boxes-product-variation.min.js +++ b/assets/js/admin/meta-boxes-product-variation.min.js @@ -1 +1 @@ -jQuery(function(a){var b={init:function(){a("#variable_product_options").on("change","input.variable_is_downloadable",this.variable_is_downloadable).on("change","input.variable_is_virtual",this.variable_is_virtual).on("change","input.variable_manage_stock",this.variable_manage_stock),a("input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock").change(),a("#woocommerce-product-data").on("woocommerce_variations_loaded",this.variations_loaded)},variable_is_downloadable:function(){a(this).closest(".woocommerce_variation").find(".show_if_variation_downloadable").hide(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".show_if_variation_downloadable").show()},variable_is_virtual:function(){a(this).closest(".woocommerce_variation").find(".hide_if_variation_virtual").show(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".hide_if_variation_virtual").hide()},variable_manage_stock:function(){a(this).closest(".woocommerce_variation").find(".show_if_variation_manage_stock").hide(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".show_if_variation_manage_stock").show()},variations_loaded:function(){a("input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock",a(this)).change(),a(".woocommerce_variation",a(this)).each(function(b,c){var d=a(c),e=a(".sale_price_dates_from",d).val(),f=a(".sale_price_dates_to",d).val();(""!==e||""!==f)&&a("a.sale_schedule",d).click()}),a(".woocommerce_variations .variation-needs-update",a(this)).removeClass("variation-needs-update"),a("button.cancel-variation-changes, button.save-variation-changes",a(this)).attr("disabled","disabled"),a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".woocommerce_variations .tips",a(this)).tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a(".sale_price_dates_fields",a(this)).each(function(){var b=a(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,onSelect:function(c){var d=a(this).is(".sale_price_dates_from")?"minDate":"maxDate",e=a(this).data("datepicker"),f=a.datepicker.parseDate(e.settings.dateFormat||a.datepicker._defaults.dateFormat,c,e.settings);b.not(this).datepicker("option",d,f),a(this).change()}})}),a(document.body).trigger("wc-enhanced-select-init")}},c={variable_image_frame:null,setting_variation_image_id:null,setting_variation_image:null,wp_media_post_id:wp.media.model.settings.post.id,init:function(){a("#variable_product_options").on("click",".upload_image_button",this.add_image),a("a.add_media").on("click",this.restore_wp_media_post_id)},add_image:function(b){var d=a(this),e=d.attr("rel"),f=d.closest(".upload_image");if(c.setting_variation_image=f,c.setting_variation_image_id=e,b.preventDefault(),d.is(".remove"))a(".upload_image_id",c.setting_variation_image).val("").change(),c.setting_variation_image.find("img").eq(0).attr("src",woocommerce_admin_meta_boxes_variations.woocommerce_placeholder_img_src),c.setting_variation_image.find(".upload_image_button").removeClass("remove");else{if(c.variable_image_frame)return c.variable_image_frame.uploader.uploader.param("post_id",c.setting_variation_image_id),void c.variable_image_frame.open();wp.media.model.settings.post.id=c.setting_variation_image_id,c.variable_image_frame=wp.media.frames.variable_image=wp.media({title:woocommerce_admin_meta_boxes_variations.i18n_choose_image,button:{text:woocommerce_admin_meta_boxes_variations.i18n_set_image},states:[new wp.media.controller.Library({title:woocommerce_admin_meta_boxes_variations.i18n_choose_image,filterable:"all"})]}),c.variable_image_frame.on("select",function(){var b=c.variable_image_frame.state().get("selection").first().toJSON(),d=b.sizes.thumbnail?b.sizes.thumbnail.url:b.url;a(".upload_image_id",c.setting_variation_image).val(b.id).change(),c.setting_variation_image.find(".upload_image_button").addClass("remove"),c.setting_variation_image.find("img").eq(0).attr("src",d),wp.media.model.settings.post.id=c.wp_media_post_id}),c.variable_image_frame.open()}},restore_wp_media_post_id:function(){wp.media.model.settings.post.id=c.wp_media_post_id}},d={init:function(){a("li.variations_tab a").on("click",this.initial_load),a("#variable_product_options").on("click","button.save-variation-changes",this.save_variations).on("click","button.cancel-variation-changes",this.cancel_variations).on("click",".remove_variation",this.remove_variation),a(document.body).on("change","#variable_product_options .woocommerce_variations :input",this.input_changed).on("change",".variations-defaults select",this.defaults_changed),a("form#post").on("submit",this.save_on_submit),a(".wc-metaboxes-wrapper").on("click","a.do_variation_action",this.do_variation_action)},check_for_changes:function(){var b=a("#variable_product_options .woocommerce_variations .variation-needs-update");if(00?(c.push(b),f.variation_ids=c,f.security=woocommerce_admin_meta_boxes_variations.delete_variations_nonce,a.post(woocommerce_admin_meta_boxes_variations.ajax_url,f,function(){var b=a("#variable_product_options .woocommerce_variations"),c=parseInt(b.attr("data-page"),10),d=Math.ceil((parseInt(b.attr("data-total"),10)-1)/woocommerce_admin_meta_boxes_variations.variations_per_page),f=1;a("#woocommerce-product-data").trigger("woocommerce_variations_removed"),c===d?f=c:c>d&&0!==d&&(f=d),e.go_to_page(f,-1)})):d.unblock()}return!1},link_all_variations:function(){if(d.check_for_changes(),window.confirm(woocommerce_admin_meta_boxes_variations.i18n_link_all_variations)){d.block();var b={action:"woocommerce_link_all_variations",post_id:woocommerce_admin_meta_boxes_variations.post_id,security:woocommerce_admin_meta_boxes_variations.link_variation_nonce};a.post(woocommerce_admin_meta_boxes_variations.ajax_url,b,function(b){var c=parseInt(b,10);1===c?window.alert(c+" "+woocommerce_admin_meta_boxes_variations.i18n_variation_added):0===c||c>1?window.alert(c+" "+woocommerce_admin_meta_boxes_variations.i18n_variations_added):window.alert(woocommerce_admin_meta_boxes_variations.i18n_no_variations_added),c>0?(e.go_to_page(1,c),a("#variable_product_options").trigger("woocommerce_variations_added",c)):d.unblock()})}return!1},input_changed:function(){a(this).closest(".woocommerce_variation").addClass("variation-needs-update"),a("button.cancel-variation-changes, button.save-variation-changes").removeAttr("disabled"),a("#variable_product_options").trigger("woocommerce_variations_input_changed")},defaults_changed:function(){a(this).closest("#variable_product_options").find(".woocommerce_variation:first").addClass("variation-needs-update"),a("button.cancel-variation-changes, button.save-variation-changes").removeAttr("disabled"),a("#variable_product_options").trigger("woocommerce_variations_defaults_changed")},do_variation_action:function(){var b,c=a("select.variation_actions").val(),f={},g=0;switch(c){case"add_variation":return void d.add_variation();case"link_all_variations":return void d.link_all_variations();case"delete_all":window.confirm(woocommerce_admin_meta_boxes_variations.i18n_delete_all_variations)&&window.confirm(woocommerce_admin_meta_boxes_variations.i18n_last_warning)&&(f.allowed=!0,g=-1*parseInt(a("#variable_product_options .woocommerce_variations").attr("data-total"),10));break;case"variable_regular_price_increase":case"variable_regular_price_decrease":case"variable_sale_price_increase":case"variable_sale_price_decrease":b=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_enter_a_value_fixed_or_percent),null!=b&&(b.indexOf("%")>=0?f.value=accounting.unformat(b.replace(/\%/,""),woocommerce_admin.mon_decimal_point)+"%":f.value=accounting.unformat(b,woocommerce_admin.mon_decimal_point));break;case"variable_regular_price":case"variable_sale_price":case"variable_stock":case"variable_weight":case"variable_length":case"variable_width":case"variable_height":case"variable_download_limit":case"variable_download_expiry":b=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_enter_a_value),null!=b&&(f.value=b);break;case"variable_sale_schedule":f.date_from=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_start),f.date_to=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_end),null===f.date_from&&(f.date_from=!1),null===f.date_to&&(f.date_to=!1);break;default:a("select.variation_actions").trigger(c)}d.check_for_changes(),d.block(),a.ajax({url:woocommerce_admin_meta_boxes_variations.ajax_url,data:{action:"woocommerce_bulk_edit_variations",security:woocommerce_admin_meta_boxes_variations.bulk_edit_variations_nonce,product_id:woocommerce_admin_meta_boxes_variations.post_id,bulk_action:c,data:f},type:"POST",success:function(){e.go_to_page(1,g)}})}},e={init:function(){a(document.body).on("woocommerce_variations_added",this.update_single_quantity).on("change",".variations-pagenav .page-selector",this.page_selector).on("click",".variations-pagenav .first-page",this.first_page).on("click",".variations-pagenav .prev-page",this.prev_page).on("click",".variations-pagenav .next-page",this.next_page).on("click",".variations-pagenav .last-page",this.last_page)},update_variations_count:function(b){var c=a("#variable_product_options .woocommerce_variations"),d=parseInt(c.attr("data-total"),10)+b,e=a(".variations-pagenav .displaying-num");return c.attr("data-total",d),1===d?e.text(woocommerce_admin_meta_boxes_variations.i18n_variation_count_single.replace("%qty%",d)):e.text(woocommerce_admin_meta_boxes_variations.i18n_variation_count_plural.replace("%qty%",d)),d},update_single_quantity:function(b,c){if(1===c){var d=a(".variations-pagenav");e.update_variations_count(c),d.is(":hidden")&&(a("option, optgroup",".variation_actions").show(),a(".variation_actions").val("add_variation"),a("#variable_product_options .toolbar").show(),d.show(),a(".pagination-links",d).hide())}},set_paginav:function(b){var c=a("#variable_product_options .woocommerce_variations"),d=e.update_variations_count(b),f=a("#variable_product_options .toolbar"),g=a(".variation_actions"),h=a(".variations-pagenav"),i=a(".pagination-links",h),j=Math.ceil(d/woocommerce_admin_meta_boxes_variations.variations_per_page),k="";c.attr("data-total_pages",j),a(".total-pages",h).text(j);for(var l=1;j>=l;l++)k+='";a(".page-selector",h).empty().html(k),0===d?(f.not(".toolbar-top, .toolbar-buttons").hide(),h.hide(),a("option, optgroup",g).hide(),a(".variation_actions").val("add_variation"),a("option",g).slice(0,2).show()):(f.show(),h.show(),a("option, optgroup",g).show(),a(".variation_actions").val("add_variation"),1===j?i.hide():i.show())},check_is_enabled:function(b){return!a(b).hasClass("disabled")},change_classes:function(b,c){var d=a(".variations-pagenav .first-page"),e=a(".variations-pagenav .prev-page"),f=a(".variations-pagenav .next-page"),g=a(".variations-pagenav .last-page");1===b?(d.addClass("disabled"),e.addClass("disabled")):(d.removeClass("disabled"),e.removeClass("disabled")),c===b?(f.addClass("disabled"),g.addClass("disabled")):(f.removeClass("disabled"),g.removeClass("disabled"))},set_page:function(b){a(".variations-pagenav .page-selector").val(b).first().change()},go_to_page:function(a,b){a=a||1,b=b||0,e.set_paginav(b),e.set_page(a)},page_selector:function(){var b=parseInt(a(this).val(),10),c=a("#variable_product_options .woocommerce_variations");d.check_for_changes(),e.change_classes(b,parseInt(c.attr("data-total_pages"),10)),d.load_variations(b)},first_page:function(){return e.check_is_enabled(this)&&e.set_page(1),!1},prev_page:function(){if(e.check_is_enabled(this)){var b=a("#variable_product_options .woocommerce_variations"),c=parseInt(b.attr("data-page"),10)-1,d=c>0?c:1;e.set_page(d)}return!1},next_page:function(){if(e.check_is_enabled(this)){var b=a("#variable_product_options .woocommerce_variations"),c=parseInt(b.attr("data-total_pages"),10),d=parseInt(b.attr("data-page"),10)+1,f=c>=d?d:c;e.set_page(f)}return!1},last_page:function(){if(e.check_is_enabled(this)){var b=a("#variable_product_options .woocommerce_variations").attr("data-total_pages");e.set_page(b)}return!1}};b.init(),c.init(),d.init(),e.init()}); \ No newline at end of file +jQuery(function(a){var b={init:function(){a("#variable_product_options").on("change","input.variable_is_downloadable",this.variable_is_downloadable).on("change","input.variable_is_virtual",this.variable_is_virtual).on("change","input.variable_manage_stock",this.variable_manage_stock),a("input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock").change(),a("#woocommerce-product-data").on("woocommerce_variations_loaded",this.variations_loaded),a(document.body).on("woocommerce_variations_added",this.variation_added)},variable_is_downloadable:function(){a(this).closest(".woocommerce_variation").find(".show_if_variation_downloadable").hide(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".show_if_variation_downloadable").show()},variable_is_virtual:function(){a(this).closest(".woocommerce_variation").find(".hide_if_variation_virtual").show(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".hide_if_variation_virtual").hide()},variable_manage_stock:function(){a(this).closest(".woocommerce_variation").find(".show_if_variation_manage_stock").hide(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".show_if_variation_manage_stock").show()},variations_loaded:function(){var b=a("#woocommerce-product-data");a("input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock",b).change(),a(".woocommerce_variation",b).each(function(b,c){var d=a(c),e=a(".sale_price_dates_from",d).val(),f=a(".sale_price_dates_to",d).val();(""!==e||""!==f)&&a("a.sale_schedule",d).click()}),a(".woocommerce_variations .variation-needs-update",b).removeClass("variation-needs-update"),a("button.cancel-variation-changes, button.save-variation-changes",b).attr("disabled","disabled"),a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".woocommerce_variations .tips",b).tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a(".sale_price_dates_fields",b).each(function(){var b=a(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,onSelect:function(c){var d=a(this).is(".sale_price_dates_from")?"minDate":"maxDate",e=a(this).data("datepicker"),f=a.datepicker.parseDate(e.settings.dateFormat||a.datepicker._defaults.dateFormat,c,e.settings);b.not(this).datepicker("option",d,f),a(this).change()}})}),a(document.body).trigger("wc-enhanced-select-init")},variation_added:function(a,c){1===c&&b.variations_loaded()}},c={variable_image_frame:null,setting_variation_image_id:null,setting_variation_image:null,wp_media_post_id:wp.media.model.settings.post.id,init:function(){a("#variable_product_options").on("click",".upload_image_button",this.add_image),a("a.add_media").on("click",this.restore_wp_media_post_id)},add_image:function(b){var d=a(this),e=d.attr("rel"),f=d.closest(".upload_image");if(c.setting_variation_image=f,c.setting_variation_image_id=e,b.preventDefault(),d.is(".remove"))a(".upload_image_id",c.setting_variation_image).val("").change(),c.setting_variation_image.find("img").eq(0).attr("src",woocommerce_admin_meta_boxes_variations.woocommerce_placeholder_img_src),c.setting_variation_image.find(".upload_image_button").removeClass("remove");else{if(c.variable_image_frame)return c.variable_image_frame.uploader.uploader.param("post_id",c.setting_variation_image_id),void c.variable_image_frame.open();wp.media.model.settings.post.id=c.setting_variation_image_id,c.variable_image_frame=wp.media.frames.variable_image=wp.media({title:woocommerce_admin_meta_boxes_variations.i18n_choose_image,button:{text:woocommerce_admin_meta_boxes_variations.i18n_set_image},states:[new wp.media.controller.Library({title:woocommerce_admin_meta_boxes_variations.i18n_choose_image,filterable:"all"})]}),c.variable_image_frame.on("select",function(){var b=c.variable_image_frame.state().get("selection").first().toJSON(),d=b.sizes.thumbnail?b.sizes.thumbnail.url:b.url;a(".upload_image_id",c.setting_variation_image).val(b.id).change(),c.setting_variation_image.find(".upload_image_button").addClass("remove"),c.setting_variation_image.find("img").eq(0).attr("src",d),wp.media.model.settings.post.id=c.wp_media_post_id}),c.variable_image_frame.open()}},restore_wp_media_post_id:function(){wp.media.model.settings.post.id=c.wp_media_post_id}},d={init:function(){a("li.variations_tab a").on("click",this.initial_load),a("#variable_product_options").on("click","button.save-variation-changes",this.save_variations).on("click","button.cancel-variation-changes",this.cancel_variations).on("click",".remove_variation",this.remove_variation),a(document.body).on("change","#variable_product_options .woocommerce_variations :input",this.input_changed).on("change",".variations-defaults select",this.defaults_changed),a("form#post").on("submit",this.save_on_submit),a(".wc-metaboxes-wrapper").on("click","a.do_variation_action",this.do_variation_action)},check_for_changes:function(){var b=a("#variable_product_options .woocommerce_variations .variation-needs-update");if(00?(c.push(b),f.variation_ids=c,f.security=woocommerce_admin_meta_boxes_variations.delete_variations_nonce,a.post(woocommerce_admin_meta_boxes_variations.ajax_url,f,function(){var b=a("#variable_product_options .woocommerce_variations"),c=parseInt(b.attr("data-page"),10),d=Math.ceil((parseInt(b.attr("data-total"),10)-1)/woocommerce_admin_meta_boxes_variations.variations_per_page),f=1;a("#woocommerce-product-data").trigger("woocommerce_variations_removed"),c===d?f=c:c>d&&0!==d&&(f=d),e.go_to_page(f,-1)})):d.unblock()}return!1},link_all_variations:function(){if(d.check_for_changes(),window.confirm(woocommerce_admin_meta_boxes_variations.i18n_link_all_variations)){d.block();var b={action:"woocommerce_link_all_variations",post_id:woocommerce_admin_meta_boxes_variations.post_id,security:woocommerce_admin_meta_boxes_variations.link_variation_nonce};a.post(woocommerce_admin_meta_boxes_variations.ajax_url,b,function(b){var c=parseInt(b,10);1===c?window.alert(c+" "+woocommerce_admin_meta_boxes_variations.i18n_variation_added):0===c||c>1?window.alert(c+" "+woocommerce_admin_meta_boxes_variations.i18n_variations_added):window.alert(woocommerce_admin_meta_boxes_variations.i18n_no_variations_added),c>0?(e.go_to_page(1,c),a("#variable_product_options").trigger("woocommerce_variations_added",c)):d.unblock()})}return!1},input_changed:function(){a(this).closest(".woocommerce_variation").addClass("variation-needs-update"),a("button.cancel-variation-changes, button.save-variation-changes").removeAttr("disabled"),a("#variable_product_options").trigger("woocommerce_variations_input_changed")},defaults_changed:function(){a(this).closest("#variable_product_options").find(".woocommerce_variation:first").addClass("variation-needs-update"),a("button.cancel-variation-changes, button.save-variation-changes").removeAttr("disabled"),a("#variable_product_options").trigger("woocommerce_variations_defaults_changed")},do_variation_action:function(){var b,c=a("select.variation_actions").val(),f={},g=0;switch(c){case"add_variation":return void d.add_variation();case"link_all_variations":return void d.link_all_variations();case"delete_all":window.confirm(woocommerce_admin_meta_boxes_variations.i18n_delete_all_variations)&&window.confirm(woocommerce_admin_meta_boxes_variations.i18n_last_warning)&&(f.allowed=!0,g=-1*parseInt(a("#variable_product_options .woocommerce_variations").attr("data-total"),10));break;case"variable_regular_price_increase":case"variable_regular_price_decrease":case"variable_sale_price_increase":case"variable_sale_price_decrease":b=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_enter_a_value_fixed_or_percent),null!=b&&(b.indexOf("%")>=0?f.value=accounting.unformat(b.replace(/\%/,""),woocommerce_admin.mon_decimal_point)+"%":f.value=accounting.unformat(b,woocommerce_admin.mon_decimal_point));break;case"variable_regular_price":case"variable_sale_price":case"variable_stock":case"variable_weight":case"variable_length":case"variable_width":case"variable_height":case"variable_download_limit":case"variable_download_expiry":b=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_enter_a_value),null!=b&&(f.value=b);break;case"variable_sale_schedule":f.date_from=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_start),f.date_to=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_end),null===f.date_from&&(f.date_from=!1),null===f.date_to&&(f.date_to=!1);break;default:a("select.variation_actions").trigger(c)}"delete_all"===c&&f.allowed?a("#variable_product_options .variation-needs-update").removeClass("variation-needs-update"):d.check_for_changes(),d.block(),a.ajax({url:woocommerce_admin_meta_boxes_variations.ajax_url,data:{action:"woocommerce_bulk_edit_variations",security:woocommerce_admin_meta_boxes_variations.bulk_edit_variations_nonce,product_id:woocommerce_admin_meta_boxes_variations.post_id,bulk_action:c,data:f},type:"POST",success:function(){e.go_to_page(1,g)}})}},e={init:function(){a(document.body).on("woocommerce_variations_added",this.update_single_quantity).on("change",".variations-pagenav .page-selector",this.page_selector).on("click",".variations-pagenav .first-page",this.first_page).on("click",".variations-pagenav .prev-page",this.prev_page).on("click",".variations-pagenav .next-page",this.next_page).on("click",".variations-pagenav .last-page",this.last_page)},update_variations_count:function(b){var c=a("#variable_product_options .woocommerce_variations"),d=parseInt(c.attr("data-total"),10)+b,e=a(".variations-pagenav .displaying-num");return c.attr("data-total",d),1===d?e.text(woocommerce_admin_meta_boxes_variations.i18n_variation_count_single.replace("%qty%",d)):e.text(woocommerce_admin_meta_boxes_variations.i18n_variation_count_plural.replace("%qty%",d)),d},update_single_quantity:function(b,c){if(1===c){var d=a(".variations-pagenav");e.update_variations_count(c),d.is(":hidden")&&(a("option, optgroup",".variation_actions").show(),a(".variation_actions").val("add_variation"),a("#variable_product_options .toolbar").show(),d.show(),a(".pagination-links",d).hide())}},set_paginav:function(b){var c=a("#variable_product_options .woocommerce_variations"),d=e.update_variations_count(b),f=a("#variable_product_options .toolbar"),g=a(".variation_actions"),h=a(".variations-pagenav"),i=a(".pagination-links",h),j=Math.ceil(d/woocommerce_admin_meta_boxes_variations.variations_per_page),k="";c.attr("data-total_pages",j),a(".total-pages",h).text(j);for(var l=1;j>=l;l++)k+='";a(".page-selector",h).empty().html(k),0===d?(f.not(".toolbar-top, .toolbar-buttons").hide(),h.hide(),a("option, optgroup",g).hide(),a(".variation_actions").val("add_variation"),a("option",g).slice(0,2).show()):(f.show(),h.show(),a("option, optgroup",g).show(),a(".variation_actions").val("add_variation"),1===j?i.hide():i.show())},check_is_enabled:function(b){return!a(b).hasClass("disabled")},change_classes:function(b,c){var d=a(".variations-pagenav .first-page"),e=a(".variations-pagenav .prev-page"),f=a(".variations-pagenav .next-page"),g=a(".variations-pagenav .last-page");1===b?(d.addClass("disabled"),e.addClass("disabled")):(d.removeClass("disabled"),e.removeClass("disabled")),c===b?(f.addClass("disabled"),g.addClass("disabled")):(f.removeClass("disabled"),g.removeClass("disabled"))},set_page:function(b){a(".variations-pagenav .page-selector").val(b).first().change()},go_to_page:function(a,b){a=a||1,b=b||0,e.set_paginav(b),e.set_page(a)},page_selector:function(){var b=parseInt(a(this).val(),10),c=a("#variable_product_options .woocommerce_variations");d.check_for_changes(),e.change_classes(b,parseInt(c.attr("data-total_pages"),10)),d.load_variations(b)},first_page:function(){return e.check_is_enabled(this)&&e.set_page(1),!1},prev_page:function(){if(e.check_is_enabled(this)){var b=a("#variable_product_options .woocommerce_variations"),c=parseInt(b.attr("data-page"),10)-1,d=c>0?c:1;e.set_page(d)}return!1},next_page:function(){if(e.check_is_enabled(this)){var b=a("#variable_product_options .woocommerce_variations"),c=parseInt(b.attr("data-total_pages"),10),d=parseInt(b.attr("data-page"),10)+1,f=c>=d?d:c;e.set_page(f)}return!1},last_page:function(){if(e.check_is_enabled(this)){var b=a("#variable_product_options .woocommerce_variations").attr("data-total_pages");e.set_page(b)}return!1}};b.init(),c.init(),d.init(),e.init()}); \ No newline at end of file diff --git a/assets/js/frontend/add-to-cart-variation.js b/assets/js/frontend/add-to-cart-variation.js index 5464c50c1ce..9104ec7a89f 100644 --- a/assets/js/frontend/add-to-cart-variation.js +++ b/assets/js/frontend/add-to-cart-variation.js @@ -25,7 +25,7 @@ // On clicking the reset variation button .on( 'click', '.reset_variations', function() { $form.find( '.variations select' ).val( '' ).change(); - $form.triggerHandler( 'reset_data' ); + $form.trigger( 'reset_data' ); return false; } ) @@ -43,8 +43,8 @@ } }); $form.find( '.woocommerce-variation-description' ).remove(); - $form.triggerHandler( 'reset_image' ); - $form.find( '.single_variation_wrap' ).slideUp( 200 ).triggerHandler( 'hide_variation' ); + $form.trigger( 'reset_image' ); + $form.find( '.single_variation_wrap' ).slideUp( 200 ).trigger( 'hide_variation' ); } ) // Reset product image @@ -110,16 +110,16 @@ $form.find( 'input[name="variation_id"], input.variation_id' ) .val( variation.variation_id ) .change(); - $form.triggerHandler( 'found_variation', [ variation ] ); + $form.trigger( 'found_variation', [ variation ] ); } else { - $form.triggerHandler( 'reset_data' ); + $form.trigger( 'reset_data' ); $form.find( '.single_variation_wrap' ).after( '

' + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + '

' ); $form.find( '.wc-no-matching-variations' ).slideDown( 200 ); } } } ); } else { - $form.triggerHandler( 'reset_data' ); + $form.trigger( 'reset_data' ); } if ( some_attributes_chosen ) { if ( $reset_variations.css( 'visibility' ) === 'hidden' ) { @@ -129,20 +129,20 @@ $reset_variations.css( 'visibility', 'hidden' ); } } else { - $form.triggerHandler( 'woocommerce_variation_select_change' ); - $form.triggerHandler( 'check_variations', [ '', false ] ); + $form.trigger( 'woocommerce_variation_select_change' ); + $form.trigger( 'check_variations', [ '', false ] ); $( this ).blur(); } // Custom event for when variation selection has been changed - $form.triggerHandler( 'woocommerce_variation_has_changed' ); + $form.trigger( 'woocommerce_variation_has_changed' ); } ) // Upon gaining focus .on( 'focusin touchstart', '.variations select', function() { if ( ! $use_ajax ) { - $form.triggerHandler( 'woocommerce_variation_select_focusin' ); - $form.triggerHandler( 'check_variations', [ $( this ).data( 'attribute_name' ) || $( this ).attr( 'name' ), true ] ); + $form.trigger( 'woocommerce_variation_select_focusin' ); + $form.trigger( 'check_variations', [ $( this ).data( 'attribute_name' ) || $( this ).attr( 'name' ), true ] ); } } ) @@ -269,7 +269,7 @@ $form.find( '.single_variation_wrap' ).prepend( '
' + variation.variation_description + '
' ); } - $single_variation_wrap.slideDown( 200 ).triggerHandler( 'show_variation', [ variation ] ); + $single_variation_wrap.slideDown( 200 ).trigger( 'show_variation', [ variation ] ); }) // Check variations @@ -312,13 +312,13 @@ $form.find( 'input[name="variation_id"], input.variation_id' ) .val( variation.variation_id ) .change(); - $form.triggerHandler( 'found_variation', [ variation ] ); + $form.trigger( 'found_variation', [ variation ] ); } else { // Nothing found - reset fields $form.find( '.variations select' ).val( '' ); if ( ! focus ) { - $form.triggerHandler( 'reset_data' ); + $form.trigger( 'reset_data' ); } window.alert( wc_add_to_cart_variation_params.i18n_no_matching_variations_text ); @@ -326,14 +326,14 @@ } else { - $form.triggerHandler( 'update_variation_values', [ matching_variations ] ); + $form.trigger( 'update_variation_values', [ matching_variations ] ); if ( ! focus ) { - $form.triggerHandler( 'reset_data' ); + $form.trigger( 'reset_data' ); } if ( ! exclude ) { - $form.find( '.single_variation_wrap' ).slideUp( 200 ).triggerHandler( 'hide_variation' ); + $form.find( '.single_variation_wrap' ).slideUp( 200 ).trigger( 'hide_variation' ); } } if ( some_attributes_chosen ) { @@ -424,10 +424,10 @@ }); // Custom event for when variations have been updated - $form.triggerHandler( 'woocommerce_update_variation_values' ); + $form.trigger( 'woocommerce_update_variation_values' ); }); - $form.triggerHandler( 'wc_variation_form' ); + $form.trigger( 'wc_variation_form' ); return $form; }; @@ -471,4 +471,4 @@ } }); -})( jQuery, window, document ); \ No newline at end of file +})( jQuery, window, document ); diff --git a/assets/js/frontend/add-to-cart-variation.min.js b/assets/js/frontend/add-to-cart-variation.min.js index dc201987d12..18b933b433a 100644 --- a/assets/js/frontend/add-to-cart-variation.min.js +++ b/assets/js/frontend/add-to-cart-variation.min.js @@ -1,4 +1,4 @@ /*! * Variations Plugin */ -!function(a,b,c,d){a.fn.wc_variation_form=function(){var c=this,f=c.closest(".product"),g=parseInt(c.data("product_id"),10),h=c.data("product_variations"),i=h===!1,j=!1,k=c.find(".reset_variations");return c.unbind("check_variations update_variation_values found_variation"),c.find(".reset_variations").unbind("click"),c.find(".variations select").unbind("change focusin"),c.on("click",".reset_variations",function(){return c.find(".variations select").val("").change(),c.triggerHandler("reset_data"),!1}).on("reset_data",function(){var b={".sku":"o_sku",".product_weight":"o_weight",".product_dimensions":"o_dimensions"};a.each(b,function(a,b){var c=f.find(a);c.attr("data-"+b)&&c.text(c.attr("data-"+b))}),c.find(".woocommerce-variation-description").remove(),c.triggerHandler("reset_image"),c.find(".single_variation_wrap").slideUp(200).triggerHandler("hide_variation")}).on("reset_image",function(){var a=f.find("div.images img:eq(0)"),b=f.find("div.images a.zoom:eq(0)"),c=a.attr("data-o_src"),e=a.attr("data-o_title"),g=a.attr("data-o_title"),h=b.attr("data-o_href");c!==d&&a.attr("src",c),h!==d&&b.attr("href",h),e!==d&&(a.attr("title",e),b.attr("title",e)),g!==d&&a.attr("alt",g)}).on("change",".variations select",function(){if(c.find('input[name="variation_id"], input.variation_id').val("").change(),c.find(".wc-no-matching-variations").remove(),i){j&&j.abort();var b=!0,d=!1,e={};c.find(".variations select").each(function(){var c=a(this).data("attribute_name")||a(this).attr("name");0===a(this).val().length?b=!1:d=!0,e[c]=a(this).val()}),b?(e.product_id=g,j=a.ajax({url:wc_cart_fragments_params.wc_ajax_url+"get_variation/",type:"POST",data:e,success:function(a){a?(c.find('input[name="variation_id"], input.variation_id').val(a.variation_id).change(),c.triggerHandler("found_variation",[a])):(c.triggerHandler("reset_data"),c.find(".single_variation_wrap").after('

'+wc_add_to_cart_variation_params.i18n_no_matching_variations_text+"

"),c.find(".wc-no-matching-variations").slideDown(200))}})):c.triggerHandler("reset_data"),d?"hidden"===k.css("visibility")&&k.css("visibility","visible").hide().fadeIn():k.css("visibility","hidden")}else c.triggerHandler("woocommerce_variation_select_change"),c.triggerHandler("check_variations",["",!1]),a(this).blur();c.triggerHandler("woocommerce_variation_has_changed")}).on("focusin touchstart",".variations select",function(){i||(c.triggerHandler("woocommerce_variation_select_focusin"),c.triggerHandler("check_variations",[a(this).data("attribute_name")||a(this).attr("name"),!0]))}).on("found_variation",function(a,b){var e=f.find("div.images img:eq(0)"),g=f.find("div.images a.zoom:eq(0)"),h=e.attr("data-o_src"),i=e.attr("data-o_title"),j=e.attr("data-o_alt"),k=g.attr("data-o_href"),l=b.image_src,m=b.image_link,n=b.image_caption,o=b.image_title;c.find(".variations_button").show(),c.find(".single_variation").html(b.price_html+b.availability_html),h===d&&(h=e.attr("src")?e.attr("src"):"",e.attr("data-o_src",h)),k===d&&(k=g.attr("href")?g.attr("href"):"",g.attr("data-o_href",k)),i===d&&(i=e.attr("title")?e.attr("title"):"",e.attr("data-o_title",i)),j===d&&(j=e.attr("alt")?e.attr("alt"):"",e.attr("data-o_alt",j)),l&&l.length>1?(e.attr("src",l).attr("alt",o).attr("title",o),g.attr("href",m).attr("title",n)):(e.attr("src",h).attr("alt",j).attr("title",i),g.attr("href",k).attr("title",i));var p=c.find(".single_variation_wrap"),q=f.find(".product_meta").find(".sku"),r=f.find(".product_weight"),s=f.find(".product_dimensions");q.attr("data-o_sku")||q.attr("data-o_sku",q.text()),r.attr("data-o_weight")||r.attr("data-o_weight",r.text()),s.attr("data-o_dimensions")||s.attr("data-o_dimensions",s.text()),b.sku?q.text(b.sku):q.text(q.attr("data-o_sku")),b.weight?r.text(b.weight):r.text(r.attr("data-o_weight")),b.dimensions?s.text(b.dimensions):s.text(s.attr("data-o_dimensions")),p.find(".quantity").show(),b.is_purchasable&&b.is_in_stock&&b.variation_is_visible||c.find(".variations_button").hide(),b.variation_is_visible||c.find(".single_variation").html("

"+wc_add_to_cart_variation_params.i18n_unavailable_text+"

"),""!==b.min_qty?p.find(".quantity input.qty").attr("min",b.min_qty).val(b.min_qty):p.find(".quantity input.qty").removeAttr("min"),""!==b.max_qty?p.find(".quantity input.qty").attr("max",b.max_qty):p.find(".quantity input.qty").removeAttr("max"),"yes"===b.is_sold_individually&&(p.find(".quantity input.qty").val("1"),p.find(".quantity").hide()),c.find(".woocommerce-variation-description").remove(),b.variation_description&&c.find(".single_variation_wrap").prepend('
'+b.variation_description+"
"),p.slideDown(200).triggerHandler("show_variation",[b])}).on("check_variations",function(c,d,f){if(!i){var g=!0,j=!1,k={},l=a(this),m=l.find(".reset_variations");l.find(".variations select").each(function(){var b=a(this).data("attribute_name")||a(this).attr("name");0===a(this).val().length?g=!1:j=!0,d&&b===d?(g=!1,k[b]=""):k[b]=a(this).val()});var n=e.find_matching_variations(h,k);if(g){var o=n.shift();o?(l.find('input[name="variation_id"], input.variation_id').val(o.variation_id).change(),l.triggerHandler("found_variation",[o])):(l.find(".variations select").val(""),f||l.triggerHandler("reset_data"),b.alert(wc_add_to_cart_variation_params.i18n_no_matching_variations_text))}else l.triggerHandler("update_variation_values",[n]),f||l.triggerHandler("reset_data"),d||l.find(".single_variation_wrap").slideUp(200).triggerHandler("hide_variation");j?"hidden"===m.css("visibility")&&m.css("visibility","visible").hide().fadeIn():m.css("visibility","hidden")}}).on("update_variation_values",function(b,d){i||(c.find(".variations select").each(function(b,c){var e,f=a(c);f.data("attribute_options")||f.data("attribute_options",f.find("option:gt(0)").get()),f.find("option:gt(0)").remove(),f.append(f.data("attribute_options")),f.find("option:gt(0)").removeClass("attached"),f.find("option:gt(0)").removeClass("enabled"),f.find("option:gt(0)").removeAttr("disabled"),e="undefined"!=typeof f.data("attribute_name")?f.data("attribute_name"):f.attr("name");for(var g in d)if("undefined"!=typeof d[g]){var h=d[g].attributes;for(var i in h)if(h.hasOwnProperty(i)){var j=h[i];if(i===e){var k="";d[g].variation_is_active&&(k="enabled"),j?(j=a("
").html(j).text(),j=j.replace(/'/g,"\\'"),j=j.replace(/"/g,'\\"'),f.find('option[value="'+j+'"]').addClass("attached "+k)):f.find("option:gt(0)").addClass("attached "+k)}}}f.find("option:gt(0):not(.attached)").remove(),f.find("option:gt(0):not(.enabled)").attr("disabled","disabled")}),c.triggerHandler("woocommerce_update_variation_values"))}),c.triggerHandler("wc_variation_form"),c};var e={find_matching_variations:function(a,b){for(var c=[],d=0;d'+wc_add_to_cart_variation_params.i18n_no_matching_variations_text+"

"),c.find(".wc-no-matching-variations").slideDown(200))}})):c.trigger("reset_data"),d?"hidden"===k.css("visibility")&&k.css("visibility","visible").hide().fadeIn():k.css("visibility","hidden")}else c.trigger("woocommerce_variation_select_change"),c.trigger("check_variations",["",!1]),a(this).blur();c.trigger("woocommerce_variation_has_changed")}).on("focusin touchstart",".variations select",function(){i||(c.trigger("woocommerce_variation_select_focusin"),c.trigger("check_variations",[a(this).data("attribute_name")||a(this).attr("name"),!0]))}).on("found_variation",function(a,b){var e=f.find("div.images img:eq(0)"),g=f.find("div.images a.zoom:eq(0)"),h=e.attr("data-o_src"),i=e.attr("data-o_title"),j=e.attr("data-o_alt"),k=g.attr("data-o_href"),l=b.image_src,m=b.image_link,n=b.image_caption,o=b.image_title;c.find(".variations_button").show(),c.find(".single_variation").html(b.price_html+b.availability_html),h===d&&(h=e.attr("src")?e.attr("src"):"",e.attr("data-o_src",h)),k===d&&(k=g.attr("href")?g.attr("href"):"",g.attr("data-o_href",k)),i===d&&(i=e.attr("title")?e.attr("title"):"",e.attr("data-o_title",i)),j===d&&(j=e.attr("alt")?e.attr("alt"):"",e.attr("data-o_alt",j)),l&&l.length>1?(e.attr("src",l).attr("alt",o).attr("title",o),g.attr("href",m).attr("title",n)):(e.attr("src",h).attr("alt",j).attr("title",i),g.attr("href",k).attr("title",i));var p=c.find(".single_variation_wrap"),q=f.find(".product_meta").find(".sku"),r=f.find(".product_weight"),s=f.find(".product_dimensions");q.attr("data-o_sku")||q.attr("data-o_sku",q.text()),r.attr("data-o_weight")||r.attr("data-o_weight",r.text()),s.attr("data-o_dimensions")||s.attr("data-o_dimensions",s.text()),b.sku?q.text(b.sku):q.text(q.attr("data-o_sku")),b.weight?r.text(b.weight):r.text(r.attr("data-o_weight")),b.dimensions?s.text(b.dimensions):s.text(s.attr("data-o_dimensions")),p.find(".quantity").show(),b.is_purchasable&&b.is_in_stock&&b.variation_is_visible||c.find(".variations_button").hide(),b.variation_is_visible||c.find(".single_variation").html("

"+wc_add_to_cart_variation_params.i18n_unavailable_text+"

"),""!==b.min_qty?p.find(".quantity input.qty").attr("min",b.min_qty).val(b.min_qty):p.find(".quantity input.qty").removeAttr("min"),""!==b.max_qty?p.find(".quantity input.qty").attr("max",b.max_qty):p.find(".quantity input.qty").removeAttr("max"),"yes"===b.is_sold_individually&&(p.find(".quantity input.qty").val("1"),p.find(".quantity").hide()),c.find(".woocommerce-variation-description").remove(),b.variation_description&&c.find(".single_variation_wrap").prepend('
'+b.variation_description+"
"),p.slideDown(200).trigger("show_variation",[b])}).on("check_variations",function(c,d,f){if(!i){var g=!0,j=!1,k={},l=a(this),m=l.find(".reset_variations");l.find(".variations select").each(function(){var b=a(this).data("attribute_name")||a(this).attr("name");0===a(this).val().length?g=!1:j=!0,d&&b===d?(g=!1,k[b]=""):k[b]=a(this).val()});var n=e.find_matching_variations(h,k);if(g){var o=n.shift();o?(l.find('input[name="variation_id"], input.variation_id').val(o.variation_id).change(),l.trigger("found_variation",[o])):(l.find(".variations select").val(""),f||l.trigger("reset_data"),b.alert(wc_add_to_cart_variation_params.i18n_no_matching_variations_text))}else l.trigger("update_variation_values",[n]),f||l.trigger("reset_data"),d||l.find(".single_variation_wrap").slideUp(200).trigger("hide_variation");j?"hidden"===m.css("visibility")&&m.css("visibility","visible").hide().fadeIn():m.css("visibility","hidden")}}).on("update_variation_values",function(b,d){i||(c.find(".variations select").each(function(b,c){var e,f=a(c);f.data("attribute_options")||f.data("attribute_options",f.find("option:gt(0)").get()),f.find("option:gt(0)").remove(),f.append(f.data("attribute_options")),f.find("option:gt(0)").removeClass("attached"),f.find("option:gt(0)").removeClass("enabled"),f.find("option:gt(0)").removeAttr("disabled"),e="undefined"!=typeof f.data("attribute_name")?f.data("attribute_name"):f.attr("name");for(var g in d)if("undefined"!=typeof d[g]){var h=d[g].attributes;for(var i in h)if(h.hasOwnProperty(i)){var j=h[i];if(i===e){var k="";d[g].variation_is_active&&(k="enabled"),j?(j=a("
").html(j).text(),j=j.replace(/'/g,"\\'"),j=j.replace(/"/g,'\\"'),f.find('option[value="'+j+'"]').addClass("attached "+k)):f.find("option:gt(0)").addClass("attached "+k)}}}f.find("option:gt(0):not(.attached)").remove(),f.find("option:gt(0):not(.enabled)").attr("disabled","disabled")}),c.trigger("woocommerce_update_variation_values"))}),c.trigger("wc_variation_form"),c};var e={find_matching_variations:function(a,b){for(var c=[],d=0;d {foo: [null, null, "v"]}, instead of {foo: ["2": "v"]} + }, + + // Merge option defaults into the options + setupOpts: function(options) { + var opt, validOpts, defaultOptions, optWithDefault, parseAll, f; + f = $.serializeJSON; + + if (options == null) { options = {}; } // options ||= {} + defaultOptions = f.defaultOptions || {}; // defaultOptions + + // Make sure that the user didn't misspell an option + validOpts = ['checkboxUncheckedValue', 'parseNumbers', 'parseBooleans', 'parseNulls', 'parseAll', 'parseWithFunction', 'customTypes', 'defaultTypes', 'useIntKeysAsArrayIndex']; // re-define because the user may override the defaultOptions + for (opt in options) { + if (validOpts.indexOf(opt) === -1) { + throw new Error("serializeJSON ERROR: invalid option '" + opt + "'. Please use one of " + validOpts.join(', ')); + } + } + + // Helper to get the default value for this option if none is specified by the user + optWithDefault = function(key) { return (options[key] !== false) && (options[key] !== '') && (options[key] || defaultOptions[key]); }; + + // Return computed options (opts to be used in the rest of the script) + parseAll = optWithDefault('parseAll'); + return { + checkboxUncheckedValue: optWithDefault('checkboxUncheckedValue'), + + parseNumbers: parseAll || optWithDefault('parseNumbers'), + parseBooleans: parseAll || optWithDefault('parseBooleans'), + parseNulls: parseAll || optWithDefault('parseNulls'), + parseWithFunction: optWithDefault('parseWithFunction'), + + typeFunctions: $.extend({}, optWithDefault('defaultTypes'), optWithDefault('customTypes')), + + useIntKeysAsArrayIndex: optWithDefault('useIntKeysAsArrayIndex') + }; + }, + + // Given a string, apply the type or the relevant "parse" options, to return the parsed value + parseValue: function(str, type, opts) { + var typeFunction, f; + f = $.serializeJSON; + + // Parse with a type if available + typeFunction = opts.typeFunctions && opts.typeFunctions[type]; + if (typeFunction) { return typeFunction(str); } // use specific type + + // Otherwise, check if there is any auto-parse option enabled and use it. + if (opts.parseNumbers && f.isNumeric(str)) { return Number(str); } // auto: number + if (opts.parseBooleans && (str === "true" || str === "false")) { return str === "true"; } // auto: boolean + if (opts.parseNulls && str == "null") { return null; } // auto: null + + // If none applies, just return the str + return str; + }, + + isObject: function(obj) { return obj === Object(obj); }, // is it an Object? + isUndefined: function(obj) { return obj === void 0; }, // safe check for undefined values + isValidArrayIndex: function(val) { return /^[0-9]+$/.test(String(val)); }, // 1,2,3,4 ... are valid array indexes + isNumeric: function(obj) { return obj - parseFloat(obj) >= 0; }, // taken from jQuery.isNumeric implementation. Not using jQuery.isNumeric to support old jQuery and Zepto versions + + optionKeys: function(obj) { if (Object.keys) { return Object.keys(obj); } else { var key, keys = []; for(key in obj){ keys.push(key); } return keys;} }, // polyfill Object.keys to get option keys in IE<9 + + // Split the input name in programatically readable keys. + // The last element is always the type (default "_"). + // Examples: + // "foo" => ['foo', '_'] + // "foo:string" => ['foo', 'string'] + // "foo:boolean" => ['foo', 'boolean'] + // "[foo]" => ['foo', '_'] + // "foo[inn][bar]" => ['foo', 'inn', 'bar', '_'] + // "foo[inn[bar]]" => ['foo', 'inn', 'bar', '_'] + // "foo[inn][arr][0]" => ['foo', 'inn', 'arr', '0', '_'] + // "arr[][val]" => ['arr', '', 'val', '_'] + // "arr[][val]:null" => ['arr', '', 'val', 'null'] + splitInputNameIntoKeysArray: function(name, opts) { + var keys, nameWithoutType, type, _ref, f; + f = $.serializeJSON; + _ref = f.extractTypeFromInputName(name, opts); nameWithoutType = _ref[0]; type = _ref[1]; + keys = nameWithoutType.split('['); // split string into array + keys = $.map(keys, function (key) { return key.replace(/\]/g, ''); }); // remove closing brackets + if (keys[0] === '') { keys.shift(); } // ensure no opening bracket ("[foo][inn]" should be same as "foo[inn]") + keys.push(type); // add type at the end + return keys; + }, + + // Returns [name-without-type, type] from name. + // "foo" => ["foo", '_'] + // "foo:boolean" => ["foo", 'boolean'] + // "foo[bar]:null" => ["foo[bar]", 'null'] + extractTypeFromInputName: function(name, opts) { + var match, validTypes, f; + if (match = name.match(/(.*):([^:]+)$/)){ + f = $.serializeJSON; + + validTypes = f.optionKeys(opts ? opts.typeFunctions : f.defaultOptions.defaultTypes); + validTypes.push('skip'); // skip is a special type that makes it easy to remove + if (validTypes.indexOf(match[2]) !== -1) { + return [match[1], match[2]]; + } else { + throw new Error("serializeJSON ERROR: Invalid type " + match[2] + " found in input name '" + name + "', please use one of " + validTypes.join(', ')); + } + } else { + return [name, '_']; // no defined type, then use parse options + } + }, + + // Set a value in an object or array, using multiple keys to set in a nested object or array: + // + // deepSet(obj, ['foo'], v) // obj['foo'] = v + // deepSet(obj, ['foo', 'inn'], v) // obj['foo']['inn'] = v // Create the inner obj['foo'] object, if needed + // deepSet(obj, ['foo', 'inn', '123'], v) // obj['foo']['arr']['123'] = v // + // + // deepSet(obj, ['0'], v) // obj['0'] = v + // deepSet(arr, ['0'], v, {useIntKeysAsArrayIndex: true}) // arr[0] = v + // deepSet(arr, [''], v) // arr.push(v) + // deepSet(obj, ['arr', ''], v) // obj['arr'].push(v) + // + // arr = []; + // deepSet(arr, ['', v] // arr => [v] + // deepSet(arr, ['', 'foo'], v) // arr => [v, {foo: v}] + // deepSet(arr, ['', 'bar'], v) // arr => [v, {foo: v, bar: v}] + // deepSet(arr, ['', 'bar'], v) // arr => [v, {foo: v, bar: v}, {bar: v}] + // + deepSet: function (o, keys, value, opts) { + var key, nextKey, tail, lastIdx, lastVal, f; + if (opts == null) { opts = {}; } + f = $.serializeJSON; + if (f.isUndefined(o)) { throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined"); } + if (!keys || keys.length === 0) { throw new Error("ArgumentError: param 'keys' expected to be an array with least one element"); } + + key = keys[0]; + + // Only one key, then it's not a deepSet, just assign the value. + if (keys.length === 1) { + if (key === '') { + o.push(value); // '' is used to push values into the array (assume o is an array) + } else { + o[key] = value; // other keys can be used as object keys or array indexes + } + + // With more keys is a deepSet. Apply recursively. + } else { + nextKey = keys[1]; + + // '' is used to push values into the array, + // with nextKey, set the value into the same object, in object[nextKey]. + // Covers the case of ['', 'foo'] and ['', 'var'] to push the object {foo, var}, and the case of nested arrays. + if (key === '') { + lastIdx = o.length - 1; // asume o is array + lastVal = o[lastIdx]; + if (f.isObject(lastVal) && (f.isUndefined(lastVal[nextKey]) || keys.length > 2)) { // if nextKey is not present in the last object element, or there are more keys to deep set + key = lastIdx; // then set the new value in the same object element + } else { + key = lastIdx + 1; // otherwise, point to set the next index in the array + } + } + + // '' is used to push values into the array "array[]" + if (nextKey === '') { + if (f.isUndefined(o[key]) || !$.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])) { + 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 + if (f.isUndefined(o[key]) || !f.isObject(o[key])) { + o[key] = {}; // define (or override) as object, to set nested properties + } + } + } + + // Recursively set the inner object + tail = keys.slice(1); + f.deepSet(o[key], tail, value, opts); + } + }, + + // Fill the formAsArray object with values for the unchecked checkbox inputs, + // using the same format as the jquery.serializeArray function. + // The value of the unchecked values is determined from the opts.checkboxUncheckedValue + // and/or the data-unchecked-value attribute of the inputs. + readCheckboxUncheckedValues: function (formAsArray, $form, opts) { + var selector, $uncheckedCheckboxes, $el, dataUncheckedValue, f; + if (opts == null) { opts = {}; } + f = $.serializeJSON; + + selector = 'input[type=checkbox][name]:not(:checked):not([disabled])'; + $uncheckedCheckboxes = $form.find(selector).add($form.filter(selector)); + $uncheckedCheckboxes.each(function (i, el) { + $el = $(el); + dataUncheckedValue = $el.attr('data-unchecked-value'); + if(dataUncheckedValue) { // data-unchecked-value has precedence over option opts.checkboxUncheckedValue + formAsArray.push({name: el.name, value: dataUncheckedValue}); + } else { + if (!f.isUndefined(opts.checkboxUncheckedValue)) { + formAsArray.push({name: el.name, value: opts.checkboxUncheckedValue}); + } + } + }); + } + + }; + +}(window.jQuery || window.Zepto || window.$)); diff --git a/assets/js/jquery-serializejson/jquery.serializejson.min.js b/assets/js/jquery-serializejson/jquery.serializejson.min.js new file mode 100755 index 00000000000..22f8eacc27a --- /dev/null +++ b/assets/js/jquery-serializejson/jquery.serializejson.min.js @@ -0,0 +1,10 @@ +/*! + SerializeJSON jQuery plugin. + https://github.com/marioizquierdo/jquery.serializeJSON + version 2.6.1 (May, 2015) + + Copyright (c) 2012, 2015 Mario Izquierdo + Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. +*/ +!function(a){"use strict";a.fn.serializeJSON=function(b){var c,d,e,f,g,h,i;return h=a.serializeJSON,i=h.setupOpts(b),d=this.serializeArray(),h.readCheckboxUncheckedValues(d,this,i),c={},a.each(d,function(a,b){e=h.splitInputNameIntoKeysArray(b.name,i),f=e.pop(),"skip"!==f&&(g=h.parseValue(b.value,f,i),i.parseWithFunction&&"_"===f&&(g=i.parseWithFunction(g,b.name)),h.deepSet(c,e,g,i))}),c},a.serializeJSON={defaultOptions:{checkboxUncheckedValue:void 0,parseNumbers:!1,parseBooleans:!1,parseNulls:!1,parseAll:!1,parseWithFunction:null,customTypes:{},defaultTypes:{string:function(a){return String(a)},number:function(a){return Number(a)},"boolean":function(a){var b=["false","null","undefined","","0"];return-1===b.indexOf(a)},"null":function(a){var b=["false","null","undefined","","0"];return-1===b.indexOf(a)?a:null},array:function(a){return JSON.parse(a)},object:function(a){return JSON.parse(a)},auto:function(b){return a.serializeJSON.parseValue(b,null,{parseNumbers:!0,parseBooleans:!0,parseNulls:!0})}},useIntKeysAsArrayIndex:!1},setupOpts:function(b){var c,d,e,f,g,h;h=a.serializeJSON,null==b&&(b={}),e=h.defaultOptions||{},d=["checkboxUncheckedValue","parseNumbers","parseBooleans","parseNulls","parseAll","parseWithFunction","customTypes","defaultTypes","useIntKeysAsArrayIndex"];for(c in b)if(-1===d.indexOf(c))throw new Error("serializeJSON ERROR: invalid option '"+c+"'. Please use one of "+d.join(", "));return f=function(a){return b[a]!==!1&&""!==b[a]&&(b[a]||e[a])},g=f("parseAll"),{checkboxUncheckedValue:f("checkboxUncheckedValue"),parseNumbers:g||f("parseNumbers"),parseBooleans:g||f("parseBooleans"),parseNulls:g||f("parseNulls"),parseWithFunction:f("parseWithFunction"),typeFunctions:a.extend({},f("defaultTypes"),f("customTypes")),useIntKeysAsArrayIndex:f("useIntKeysAsArrayIndex")}},parseValue:function(b,c,d){var e,f;return f=a.serializeJSON,e=d.typeFunctions&&d.typeFunctions[c],e?e(b):d.parseNumbers&&f.isNumeric(b)?Number(b):!d.parseBooleans||"true"!==b&&"false"!==b?d.parseNulls&&"null"==b?null:b:"true"===b},isObject:function(a){return a===Object(a)},isUndefined:function(a){return void 0===a},isValidArrayIndex:function(a){return/^[0-9]+$/.test(String(a))},isNumeric:function(a){return a-parseFloat(a)>=0},optionKeys:function(a){if(Object.keys)return Object.keys(a);var b,c=[];for(b in a)c.push(b);return c},splitInputNameIntoKeysArray:function(b,c){var d,e,f,g,h;return h=a.serializeJSON,g=h.extractTypeFromInputName(b,c),e=g[0],f=g[1],d=e.split("["),d=a.map(d,function(a){return a.replace(/\]/g,"")}),""===d[0]&&d.shift(),d.push(f),d},extractTypeFromInputName:function(b,c){var d,e,f;if(d=b.match(/(.*):([^:]+)$/)){if(f=a.serializeJSON,e=f.optionKeys(c?c.typeFunctions:f.defaultOptions.defaultTypes),e.push("skip"),-1!==e.indexOf(d[2]))return[d[1],d[2]];throw new Error("serializeJSON ERROR: Invalid type "+d[2]+" found in input name '"+b+"', please use one of "+e.join(", "))}return[b,"_"]},deepSet:function(b,c,d,e){var f,g,h,i,j,k;if(null==e&&(e={}),k=a.serializeJSON,k.isUndefined(b))throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined");if(!c||0===c.length)throw new Error("ArgumentError: param 'keys' expected to be an array with least one element");f=c[0],1===c.length?""===f?b.push(d):b[f]=d:(g=c[1],""===f&&(i=b.length-1,j=b[i],f=k.isObject(j)&&(k.isUndefined(j[g])||c.length>2)?i:i+1),""===g?(k.isUndefined(b[f])||!a.isArray(b[f]))&&(b[f]=[]):e.useIntKeysAsArrayIndex&&k.isValidArrayIndex(g)?(k.isUndefined(b[f])||!a.isArray(b[f]))&&(b[f]=[]):(k.isUndefined(b[f])||!k.isObject(b[f]))&&(b[f]={}),h=c.slice(1),k.deepSet(b[f],h,d,e))},readCheckboxUncheckedValues:function(b,c,d){var e,f,g,h,i;null==d&&(d={}),i=a.serializeJSON,e="input[type=checkbox][name]:not(:checked):not([disabled])",f=c.find(e).add(c.filter(e)),f.each(function(c,e){g=a(e),h=g.attr("data-unchecked-value"),h?b.push({name:e.name,value:h}):i.isUndefined(d.checkboxUncheckedValue)||b.push({name:e.name,value:d.checkboxUncheckedValue})})}}}(window.jQuery||window.Zepto||window.$); \ No newline at end of file diff --git a/i18n/languages/woocommerce-admin.pot b/i18n/languages/woocommerce-admin.pot index 7b7d4c84166..bc34d5b3e17 100644 --- a/i18n/languages/woocommerce-admin.pot +++ b/i18n/languages/woocommerce-admin.pot @@ -2,9 +2,9 @@ # This file is distributed under the same license as the WooCommerce package. msgid "" msgstr "" -"Project-Id-Version: WooCommerce 2.4.0-dev Admin\n" +"Project-Id-Version: WooCommerce 2.4.0-beta-3 Admin\n" "Report-Msgid-Bugs-To: https://github.com/woothemes/woocommerce/issues\n" -"POT-Creation-Date: 2015-07-13 14:03:09+00:00\n" +"POT-Creation-Date: 2015-07-15 19:40:51+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -106,133 +106,133 @@ msgstr "" msgid "WooCommerce" msgstr "" -#: includes/admin/class-wc-admin-assets.php:137 +#: includes/admin/class-wc-admin-assets.php:138 msgid "Please enter in decimal (%s) format without thousand separators." msgstr "" -#: includes/admin/class-wc-admin-assets.php:138 +#: includes/admin/class-wc-admin-assets.php:139 msgid "" "Please enter in monetary decimal (%s) format without thousand separators " "and currency symbols." msgstr "" -#: includes/admin/class-wc-admin-assets.php:139 +#: includes/admin/class-wc-admin-assets.php:140 msgid "Please enter in country code with two capital letters." msgstr "" -#: includes/admin/class-wc-admin-assets.php:140 +#: includes/admin/class-wc-admin-assets.php:141 msgid "Please enter in a value less than the regular price." msgstr "" -#: includes/admin/class-wc-admin-assets.php:175 +#: includes/admin/class-wc-admin-assets.php:176 msgid "" "Are you sure you want to link all variations? This will create a new " "variation for each and every possible combination of variation attributes " "(max 50 per run)." msgstr "" -#: includes/admin/class-wc-admin-assets.php:176 +#: includes/admin/class-wc-admin-assets.php:177 msgid "Enter a value" msgstr "" -#: includes/admin/class-wc-admin-assets.php:177 +#: includes/admin/class-wc-admin-assets.php:178 msgid "Enter a value (fixed or %)" msgstr "" -#: includes/admin/class-wc-admin-assets.php:178 +#: includes/admin/class-wc-admin-assets.php:179 msgid "Are you sure you want to delete all variations? This cannot be undone." msgstr "" -#: includes/admin/class-wc-admin-assets.php:179 +#: includes/admin/class-wc-admin-assets.php:180 msgid "Last warning, are you sure?" msgstr "" -#: includes/admin/class-wc-admin-assets.php:180 +#: includes/admin/class-wc-admin-assets.php:181 #: includes/admin/class-wc-admin-taxonomies.php:129 #: includes/admin/class-wc-admin-taxonomies.php:220 msgid "Choose an image" msgstr "" -#: includes/admin/class-wc-admin-assets.php:181 +#: includes/admin/class-wc-admin-assets.php:182 msgid "Set variation image" msgstr "" -#: includes/admin/class-wc-admin-assets.php:182 +#: includes/admin/class-wc-admin-assets.php:183 msgid "variation added" msgstr "" -#: includes/admin/class-wc-admin-assets.php:183 +#: includes/admin/class-wc-admin-assets.php:184 msgid "variations added" msgstr "" -#: includes/admin/class-wc-admin-assets.php:184 +#: includes/admin/class-wc-admin-assets.php:185 msgid "No variations added" msgstr "" -#: includes/admin/class-wc-admin-assets.php:185 +#: includes/admin/class-wc-admin-assets.php:186 msgid "Are you sure you want to remove this variation?" msgstr "" -#: includes/admin/class-wc-admin-assets.php:186 +#: includes/admin/class-wc-admin-assets.php:187 msgid "Sale start date (YYYY-MM-DD format or leave blank)" msgstr "" -#: includes/admin/class-wc-admin-assets.php:187 +#: includes/admin/class-wc-admin-assets.php:188 msgid "Sale end date (YYYY-MM-DD format or leave blank)" msgstr "" -#: includes/admin/class-wc-admin-assets.php:188 +#: includes/admin/class-wc-admin-assets.php:189 msgid "Save changes before changing page?" msgstr "" -#: includes/admin/class-wc-admin-assets.php:189 +#: includes/admin/class-wc-admin-assets.php:190 msgid "%qty% variation" msgstr "" -#: includes/admin/class-wc-admin-assets.php:190 +#: includes/admin/class-wc-admin-assets.php:191 msgid "%qty% variations" msgstr "" -#: includes/admin/class-wc-admin-assets.php:202 -#: includes/admin/class-wc-admin-assets.php:323 +#: includes/admin/class-wc-admin-assets.php:203 +#: includes/admin/class-wc-admin-assets.php:324 #: includes/admin/settings/views/html-webhooks-edit.php:50 msgid "Select an option…" msgstr "" -#: includes/admin/class-wc-admin-assets.php:212 +#: includes/admin/class-wc-admin-assets.php:213 msgid "" "Are you sure you want to remove the selected items? If you have previously " "reduced this item's stock, or this order was submitted by a customer, you " "will need to manually restore the item's stock." msgstr "" -#: includes/admin/class-wc-admin-assets.php:213 +#: includes/admin/class-wc-admin-assets.php:214 msgid "Please select some items." msgstr "" -#: includes/admin/class-wc-admin-assets.php:214 +#: includes/admin/class-wc-admin-assets.php:215 msgid "Are you sure you wish to process this refund? This action cannot be undone." msgstr "" -#: includes/admin/class-wc-admin-assets.php:215 +#: includes/admin/class-wc-admin-assets.php:216 msgid "Are you sure you wish to delete this refund? This action cannot be undone." msgstr "" -#: includes/admin/class-wc-admin-assets.php:216 +#: includes/admin/class-wc-admin-assets.php:217 msgid "" "Are you sure you wish to delete this tax column? This action cannot be " "undone." msgstr "" -#: includes/admin/class-wc-admin-assets.php:217 +#: includes/admin/class-wc-admin-assets.php:218 msgid "Remove this item meta?" msgstr "" -#: includes/admin/class-wc-admin-assets.php:218 +#: includes/admin/class-wc-admin-assets.php:219 msgid "Remove this attribute?" msgstr "" -#: includes/admin/class-wc-admin-assets.php:219 +#: includes/admin/class-wc-admin-assets.php:220 #: includes/admin/class-wc-admin-attributes.php:267 #: includes/admin/class-wc-admin-attributes.php:322 #: includes/admin/class-wc-admin-attributes.php:356 @@ -251,71 +251,71 @@ msgstr "" msgid "Name" msgstr "" -#: includes/admin/class-wc-admin-assets.php:220 +#: includes/admin/class-wc-admin-assets.php:221 #: includes/admin/meta-boxes/views/html-product-attribute.php:3 #: includes/admin/meta-boxes/views/html-variation-admin.php:17 msgid "Remove" msgstr "" -#: includes/admin/class-wc-admin-assets.php:221 +#: includes/admin/class-wc-admin-assets.php:222 #: includes/admin/meta-boxes/views/html-order-download-permission.php:11 #: includes/admin/meta-boxes/views/html-product-attribute.php:4 #: includes/admin/meta-boxes/views/html-variation-admin.php:18 msgid "Click to toggle" msgstr "" -#: includes/admin/class-wc-admin-assets.php:222 +#: includes/admin/class-wc-admin-assets.php:223 #: includes/admin/meta-boxes/views/html-product-attribute.php:25 msgid "Value(s)" msgstr "" -#: includes/admin/class-wc-admin-assets.php:223 +#: includes/admin/class-wc-admin-assets.php:224 msgid "Enter some text, or some attributes by pipe (|) separating values." msgstr "" -#: includes/admin/class-wc-admin-assets.php:224 +#: includes/admin/class-wc-admin-assets.php:225 #: includes/admin/meta-boxes/views/html-product-attribute.php:66 msgid "Visible on the product page" msgstr "" -#: includes/admin/class-wc-admin-assets.php:225 +#: includes/admin/class-wc-admin-assets.php:226 #: includes/admin/meta-boxes/views/html-product-attribute.php:72 msgid "Used for variations" msgstr "" -#: includes/admin/class-wc-admin-assets.php:226 +#: includes/admin/class-wc-admin-assets.php:227 msgid "Enter a name for the new attribute term:" msgstr "" -#: includes/admin/class-wc-admin-assets.php:227 +#: includes/admin/class-wc-admin-assets.php:228 msgid "Calculate totals based on order items, discounts, and shipping?" msgstr "" -#: includes/admin/class-wc-admin-assets.php:228 +#: includes/admin/class-wc-admin-assets.php:229 msgid "" "Calculate line taxes? This will calculate taxes based on the customers " "country. If no billing/shipping is set it will use the store base country." msgstr "" -#: includes/admin/class-wc-admin-assets.php:229 +#: includes/admin/class-wc-admin-assets.php:230 msgid "" "Copy billing information to shipping information? This will remove any " "currently entered shipping information." msgstr "" -#: includes/admin/class-wc-admin-assets.php:230 +#: includes/admin/class-wc-admin-assets.php:231 msgid "" "Load the customer's billing information? This will remove any currently " "entered billing information." msgstr "" -#: includes/admin/class-wc-admin-assets.php:231 +#: includes/admin/class-wc-admin-assets.php:232 msgid "" "Load the customer's shipping information? This will remove any currently " "entered shipping information." msgstr "" -#: includes/admin/class-wc-admin-assets.php:232 +#: includes/admin/class-wc-admin-assets.php:233 #: includes/admin/class-wc-admin-post-types.php:218 #: includes/admin/class-wc-admin-post-types.php:2013 #: includes/admin/views/html-bulk-edit-product.php:197 @@ -323,26 +323,26 @@ msgstr "" msgid "Featured" msgstr "" -#: includes/admin/class-wc-admin-assets.php:235 +#: includes/admin/class-wc-admin-assets.php:236 msgid "No customer selected" msgstr "" -#: includes/admin/class-wc-admin-assets.php:259 +#: includes/admin/class-wc-admin-assets.php:260 msgid "" "Could not grant access - the user may already have permission for this file " "or billing email is not set. Ensure the billing email is set, and the order " "has been saved." msgstr "" -#: includes/admin/class-wc-admin-assets.php:260 +#: includes/admin/class-wc-admin-assets.php:261 msgid "Are you sure you want to revoke access to this download?" msgstr "" -#: includes/admin/class-wc-admin-assets.php:261 +#: includes/admin/class-wc-admin-assets.php:262 msgid "You cannot add the same tax rate twice!" msgstr "" -#: includes/admin/class-wc-admin-assets.php:262 +#: includes/admin/class-wc-admin-assets.php:263 msgid "" "Your product has variations! Before changing the product type, it is a good " "idea to delete the variations to avoid errors in the stock reports." @@ -1025,7 +1025,6 @@ msgid "" msgstr "" #: includes/admin/class-wc-admin-pointers.php:141 -#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:666 msgid "Prices" msgstr "" @@ -1507,7 +1506,7 @@ msgstr "" #: includes/admin/class-wc-admin-post-types.php:645 #: includes/admin/class-wc-admin-post-types.php:647 #: includes/admin/class-wc-admin-post-types.php:649 -#: includes/admin/settings/class-wc-settings-checkout.php:287 +#: includes/admin/settings/class-wc-settings-checkout.php:285 #: includes/admin/settings/class-wc-settings-shipping.php:225 #: includes/admin/views/html-bulk-edit-product.php:203 #: includes/admin/views/html-bulk-edit-product.php:240 @@ -2903,70 +2902,70 @@ msgstr "" msgid "Thank you for selling with WooCommerce." msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:102 +#: includes/admin/importers/class-wc-tax-rate-importer.php:104 msgid "The file does not exist, please try again." msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:137 +#: includes/admin/importers/class-wc-tax-rate-importer.php:139 msgid "The CSV is invalid." msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:145 +#: includes/admin/importers/class-wc-tax-rate-importer.php:147 msgid "Import complete - imported %s tax rates." msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:155 +#: includes/admin/importers/class-wc-tax-rate-importer.php:157 msgid "All done!" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:155 +#: includes/admin/importers/class-wc-tax-rate-importer.php:157 msgid "View Tax Rates" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:191 +#: includes/admin/importers/class-wc-tax-rate-importer.php:193 msgid "Import Tax Rates" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:207 +#: includes/admin/importers/class-wc-tax-rate-importer.php:209 msgid "" "Hi there! Upload a CSV file containing tax rates to import the contents " "into your shop. Choose a .csv file to upload, then click \"Upload file and " "import\"." msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:209 +#: includes/admin/importers/class-wc-tax-rate-importer.php:211 msgid "" "Tax rates need to be defined with columns in a specific order (10 columns). " "Click here to download a sample." msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:217 +#: includes/admin/importers/class-wc-tax-rate-importer.php:219 msgid "" "Before you can upload your import file, you will need to fix the following " "error:" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:226 +#: includes/admin/importers/class-wc-tax-rate-importer.php:228 msgid "Choose a file from your computer:" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:232 +#: includes/admin/importers/class-wc-tax-rate-importer.php:234 msgid "Maximum size: %s" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:237 +#: includes/admin/importers/class-wc-tax-rate-importer.php:239 msgid "OR enter path to file:" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:244 +#: includes/admin/importers/class-wc-tax-rate-importer.php:246 msgid "Delimiter" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:250 +#: includes/admin/importers/class-wc-tax-rate-importer.php:252 msgid "Upload file and import" msgstr "" -#: includes/admin/importers/class-wc-tax-rate-importer.php:264 +#: includes/admin/importers/class-wc-tax-rate-importer.php:266 msgid "Sorry, there has been an error." msgstr "" @@ -3481,7 +3480,6 @@ msgid "Leave blank for unlimited re-downloads." msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:234 -#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:686 msgid "Download Expiry" msgstr "" @@ -3694,7 +3692,6 @@ msgid "" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:490 -#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:510 msgid "Cross-Sells" msgstr "" @@ -3704,6 +3701,10 @@ msgid "" "current product." msgstr "" +#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:510 +msgid "Grouping" +msgstr "" + #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:519 msgid "Set this option to make this product part of a grouped product." msgstr "" @@ -3751,7 +3752,7 @@ msgid "No default" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:657 -msgid "Add Variation" +msgid "Add variation" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:658 @@ -3778,28 +3779,32 @@ msgstr "" msgid "Pricing" msgstr "" +#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:666 +msgid "Set regular prices" +msgstr "" + #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:667 -msgid "Prices increase by (fixed amount or %)" +msgid "Increase regular prices (fixed amount or percentage)" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:668 -msgid "Prices decrease by (fixed amount or %)" +msgid "Decrease regular prices (fixed amount or percentage)" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:669 -msgid "Sale prices" +msgid "Set sale prices" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:670 -msgid "Sale prices increase by (fixed amount or %)" +msgid "Increase sale prices (fixed amount or percentage)" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:671 -msgid "Sale prices decrease by (fixed amount or %)" +msgid "Decrease sale prices (fixed amount or percentage)" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:672 -msgid "Scheduled sale dates" +msgid "Set scheduled sale dates" msgstr "" #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:675 @@ -3814,6 +3819,10 @@ msgstr "" msgid "Download limit" msgstr "" +#: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:686 +msgid "Download expiry" +msgstr "" + #: includes/admin/meta-boxes/class-wc-meta-box-product-data.php:690 #: includes/admin/views/html-report-by-date.php:41 msgid "Go" @@ -6836,21 +6845,6 @@ msgstr "" msgid "Sold Individually?" msgstr "" -#: includes/admin/views/html-notice-frontend-colors.php:20 -msgid "" -"The Frontend Style options are deprecated – If you " -"want to continue editing the colors of your store we recommended that you " -"install the replacement WooCommerce Colors plugin from WordPress.org." -msgstr "" - -#: includes/admin/views/html-notice-frontend-colors.php:21 -msgid "Install the new WooCommerce Colors plugin" -msgstr "" - -#: includes/admin/views/html-notice-frontend-colors.php:21 -msgid "Hide this notice" -msgstr "" - #: includes/admin/views/html-notice-install.php:12 msgid "" "Welcome to WooCommerce – You‘re almost ready " @@ -6958,73 +6952,73 @@ msgstr "" msgid "http://woothemes.com" msgstr "" -#: includes/admin/class-wc-admin-assets.php:102 +#: includes/admin/class-wc-admin-assets.php:103 #: includes/admin/class-wc-admin-setup-wizard.php:97 msgctxt "enhanced select" msgid "One result is available, press enter to select it." msgstr "" -#: includes/admin/class-wc-admin-assets.php:103 +#: includes/admin/class-wc-admin-assets.php:104 #: includes/admin/class-wc-admin-setup-wizard.php:98 msgctxt "enhanced select" msgid "%qty% results are available, use up and down arrow keys to navigate." msgstr "" -#: includes/admin/class-wc-admin-assets.php:104 +#: includes/admin/class-wc-admin-assets.php:105 #: includes/admin/class-wc-admin-setup-wizard.php:99 msgctxt "enhanced select" msgid "No matches found" msgstr "" -#: includes/admin/class-wc-admin-assets.php:105 +#: includes/admin/class-wc-admin-assets.php:106 #: includes/admin/class-wc-admin-setup-wizard.php:100 msgctxt "enhanced select" msgid "Loading failed" msgstr "" -#: includes/admin/class-wc-admin-assets.php:106 +#: includes/admin/class-wc-admin-assets.php:107 #: includes/admin/class-wc-admin-setup-wizard.php:101 msgctxt "enhanced select" msgid "Please enter 1 or more characters" msgstr "" -#: includes/admin/class-wc-admin-assets.php:107 +#: includes/admin/class-wc-admin-assets.php:108 #: includes/admin/class-wc-admin-setup-wizard.php:102 msgctxt "enhanced select" msgid "Please enter %qty% or more characters" msgstr "" -#: includes/admin/class-wc-admin-assets.php:108 +#: includes/admin/class-wc-admin-assets.php:109 #: includes/admin/class-wc-admin-setup-wizard.php:103 msgctxt "enhanced select" msgid "Please delete 1 character" msgstr "" -#: includes/admin/class-wc-admin-assets.php:109 +#: includes/admin/class-wc-admin-assets.php:110 #: includes/admin/class-wc-admin-setup-wizard.php:104 msgctxt "enhanced select" msgid "Please delete %qty% characters" msgstr "" -#: includes/admin/class-wc-admin-assets.php:110 +#: includes/admin/class-wc-admin-assets.php:111 #: includes/admin/class-wc-admin-setup-wizard.php:105 msgctxt "enhanced select" msgid "You can only select 1 item" msgstr "" -#: includes/admin/class-wc-admin-assets.php:111 +#: includes/admin/class-wc-admin-assets.php:112 #: includes/admin/class-wc-admin-setup-wizard.php:106 msgctxt "enhanced select" msgid "You can only select %qty% items" msgstr "" -#: includes/admin/class-wc-admin-assets.php:112 +#: includes/admin/class-wc-admin-assets.php:113 #: includes/admin/class-wc-admin-setup-wizard.php:107 msgctxt "enhanced select" msgid "Loading more results…" msgstr "" -#: includes/admin/class-wc-admin-assets.php:113 +#: includes/admin/class-wc-admin-assets.php:114 #: includes/admin/class-wc-admin-setup-wizard.php:108 msgctxt "enhanced select" msgid "Searching…" diff --git a/i18n/languages/woocommerce.pot b/i18n/languages/woocommerce.pot index 7a2a5c68c4c..4eeb3e63394 100644 --- a/i18n/languages/woocommerce.pot +++ b/i18n/languages/woocommerce.pot @@ -2,9 +2,9 @@ # This file is distributed under the same license as the WooCommerce package. msgid "" msgstr "" -"Project-Id-Version: WooCommerce 2.4.0-dev Frontend\n" +"Project-Id-Version: WooCommerce 2.4.0-beta-3 Frontend\n" "Report-Msgid-Bugs-To: https://github.com/woothemes/woocommerce/issues\n" -"POT-Creation-Date: 2015-07-13 14:03:08+00:00\n" +"POT-Creation-Date: 2015-07-15 19:40:50+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -5091,11 +5091,11 @@ msgstr "" msgid "Backordered" msgstr "" -#: includes/abstracts/abstract-wc-order.php:1766 +#: includes/abstracts/abstract-wc-order.php:1764 msgid " %svia %s" msgstr "" -#: includes/abstracts/abstract-wc-order.php:1771 +#: includes/abstracts/abstract-wc-order.php:1769 #: includes/abstracts/abstract-wc-product.php:967 #: includes/abstracts/abstract-wc-product.php:973 #: includes/class-wc-cart.php:1541 includes/class-wc-product-variable.php:328 @@ -5103,36 +5103,31 @@ msgstr "" msgid "Free!" msgstr "" -#: includes/abstracts/abstract-wc-order.php:1834 +#: includes/abstracts/abstract-wc-order.php:1832 msgid "Subtotal:" msgstr "" -#: includes/abstracts/abstract-wc-order.php:1841 +#: includes/abstracts/abstract-wc-order.php:1839 msgid "Discount:" msgstr "" -#: includes/abstracts/abstract-wc-order.php:1848 +#: includes/abstracts/abstract-wc-order.php:1846 msgid "Shipping:" msgstr "" -#: includes/abstracts/abstract-wc-order.php:1901 +#: includes/abstracts/abstract-wc-order.php:1899 #: includes/shortcodes/class-wc-shortcode-checkout.php:144 #: templates/checkout/thankyou.php:53 msgid "Payment Method:" msgstr "" -#: includes/abstracts/abstract-wc-order.php:1925 -#: includes/wc-cart-functions.php:252 -msgid "(Includes %s)" -msgstr "" - -#: includes/abstracts/abstract-wc-order.php:1939 +#: includes/abstracts/abstract-wc-order.php:1905 #: includes/shortcodes/class-wc-shortcode-checkout.php:139 #: templates/checkout/thankyou.php:48 msgid "Total:" msgstr "" -#: includes/abstracts/abstract-wc-order.php:2175 +#: includes/abstracts/abstract-wc-order.php:2141 msgid "Download file%s" msgstr "" @@ -5140,16 +5135,16 @@ msgstr "" msgid "WooCommerce" msgstr "" -#: includes/abstracts/abstract-wc-order.php:2260 +#: includes/abstracts/abstract-wc-order.php:2226 msgid "Order status changed from %s to %s." msgstr "" -#: includes/abstracts/abstract-wc-order.php:2522 +#: includes/abstracts/abstract-wc-order.php:2488 msgid "Item's #%s variation #%s stock reduced from %s to %s." msgstr "" -#: includes/abstracts/abstract-wc-order.php:2524 -#: includes/class-wc-ajax.php:1366 +#: includes/abstracts/abstract-wc-order.php:2490 +#: includes/class-wc-ajax.php:1371 msgid "Item #%s stock reduced from %s to %s." msgstr "" @@ -5187,40 +5182,40 @@ msgstr "" #: includes/abstracts/abstract-wc-product.php:627 #: includes/abstracts/abstract-wc-product.php:638 #: includes/abstracts/abstract-wc-product.php:660 -#: includes/class-wc-ajax.php:780 includes/class-wc-ajax.php:2410 -#: includes/class-wc-product-variation.php:551 -#: includes/class-wc-product-variation.php:561 -#: includes/class-wc-product-variation.php:577 +#: includes/class-wc-ajax.php:783 includes/class-wc-ajax.php:2418 +#: includes/class-wc-product-variation.php:560 +#: includes/class-wc-product-variation.php:570 +#: includes/class-wc-product-variation.php:586 msgid "In stock" msgstr "" #: includes/abstracts/abstract-wc-product.php:632 -#: includes/class-wc-product-variation.php:555 +#: includes/class-wc-product-variation.php:564 msgid "Only %s left in stock" msgstr "" #: includes/abstracts/abstract-wc-product.php:635 #: includes/abstracts/abstract-wc-product.php:646 -#: includes/class-wc-product-variation.php:558 -#: includes/class-wc-product-variation.php:568 +#: includes/class-wc-product-variation.php:567 +#: includes/class-wc-product-variation.php:577 msgid "(can be backordered)" msgstr "" #: includes/abstracts/abstract-wc-product.php:643 -#: includes/class-wc-product-variation.php:565 +#: includes/class-wc-product-variation.php:574 msgid "%s in stock" msgstr "" #: includes/abstracts/abstract-wc-product.php:655 -#: includes/class-wc-product-variation.php:574 templates/cart/cart.php:82 +#: includes/class-wc-product-variation.php:583 templates/cart/cart.php:82 msgid "Available on backorder" msgstr "" #: includes/abstracts/abstract-wc-product.php:665 #: includes/abstracts/abstract-wc-product.php:671 -#: includes/class-wc-ajax.php:781 includes/class-wc-ajax.php:2411 -#: includes/class-wc-product-variation.php:580 -#: includes/class-wc-product-variation.php:584 +#: includes/class-wc-ajax.php:784 includes/class-wc-ajax.php:2419 +#: includes/class-wc-product-variation.php:589 +#: includes/class-wc-product-variation.php:593 msgid "Out of stock" msgstr "" @@ -5786,7 +5781,7 @@ msgstr "" #: includes/api/class-wc-api-products.php:1237 #: includes/api/v2/class-wc-api-products.php:1237 -#: includes/class-wc-ajax.php:2609 +#: includes/class-wc-ajax.php:2617 msgid "Variation #%s of %s" msgstr "" @@ -6064,102 +6059,102 @@ msgstr "" msgid "Return to homepage" msgstr "" -#: includes/class-wc-ajax.php:765 includes/class-wc-ajax.php:2393 +#: includes/class-wc-ajax.php:768 includes/class-wc-ajax.php:2401 #: includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php:212 msgid "Standard" msgstr "" -#: includes/class-wc-ajax.php:774 includes/class-wc-ajax.php:2403 +#: includes/class-wc-ajax.php:777 includes/class-wc-ajax.php:2411 msgid "Do not allow" msgstr "" -#: includes/class-wc-ajax.php:775 includes/class-wc-ajax.php:2404 +#: includes/class-wc-ajax.php:778 includes/class-wc-ajax.php:2412 msgid "Allow, but notify customer" msgstr "" -#: includes/class-wc-ajax.php:776 includes/class-wc-ajax.php:2405 +#: includes/class-wc-ajax.php:779 includes/class-wc-ajax.php:2413 msgid "Allow" msgstr "" -#: includes/class-wc-ajax.php:1071 +#: includes/class-wc-ajax.php:1076 msgid "File %d" msgstr "" -#: includes/class-wc-ajax.php:1377 +#: includes/class-wc-ajax.php:1382 msgid "" "No products had their stock reduced - they may not have stock management " "enabled." msgstr "" -#: includes/class-wc-ajax.php:1418 includes/class-wc-ajax.php:2206 +#: includes/class-wc-ajax.php:1423 includes/class-wc-ajax.php:2211 msgid "Item #%s stock increased from %s to %s." msgstr "" -#: includes/class-wc-ajax.php:1428 +#: includes/class-wc-ajax.php:1433 msgid "" "No products had their stock increased - they may not have stock management " "enabled." msgstr "" -#: includes/class-wc-ajax.php:1447 +#: includes/class-wc-ajax.php:1452 #: includes/widgets/class-wc-widget-product-categories.php:52 #: templates/single-product-reviews.php:65 msgid "Name" msgstr "" -#: includes/class-wc-ajax.php:1447 +#: includes/class-wc-ajax.php:1452 msgid "Value" msgstr "" -#: includes/class-wc-ajax.php:1697 +#: includes/class-wc-ajax.php:1702 msgid "Delete note" msgstr "" -#: includes/class-wc-ajax.php:2146 +#: includes/class-wc-ajax.php:2151 msgid "Invalid refund amount" msgstr "" -#: includes/class-wc-ajax.php:2191 +#: includes/class-wc-ajax.php:2196 msgid "Refund failed" msgstr "" -#: includes/class-wc-ajax.php:2285 +#: includes/class-wc-ajax.php:2290 msgid "Description is missing." msgstr "" -#: includes/class-wc-ajax.php:2288 +#: includes/class-wc-ajax.php:2293 msgid "User is missing." msgstr "" -#: includes/class-wc-ajax.php:2291 +#: includes/class-wc-ajax.php:2296 msgid "Permissions is missing." msgstr "" -#: includes/class-wc-ajax.php:2320 +#: includes/class-wc-ajax.php:2325 msgid "API Key updated successfully." msgstr "" -#: includes/class-wc-ajax.php:2349 +#: includes/class-wc-ajax.php:2354 msgid "" "API Key generated successfully. Make sure to copy your new API keys now. " "You won't be able to see it again!" msgstr "" -#: includes/class-wc-ajax.php:2350 +#: includes/class-wc-ajax.php:2355 msgid "Revoke Key" msgstr "" -#: includes/class-wc-ajax.php:2653 +#: includes/class-wc-ajax.php:2661 msgid "Variation SKU must be unique." msgstr "" -#: includes/class-wc-ajax.php:2773 +#: includes/class-wc-ajax.php:2781 msgid "" "The downloadable file %s cannot be used as it does not have an allowed file " "type. Allowed types include: %s" msgstr "" -#: includes/class-wc-ajax.php:2780 +#: includes/class-wc-ajax.php:2788 msgid "The downloadable file %s cannot be used as it does not exist on the server." msgstr "" @@ -6293,7 +6288,7 @@ msgstr "" msgid "Page %d" msgstr "" -#: includes/class-wc-cache-helper.php:182 +#: includes/class-wc-cache-helper.php:190 msgid "" "In order for database caching to work with WooCommerce you " "must add _wc_session_ to the \"Ignored Query Strings\" option " @@ -6952,6 +6947,10 @@ msgstr "" msgid "Premium Support" msgstr "" +#: includes/class-wc-order.php:40 includes/wc-cart-functions.php:252 +msgid "(Includes %s)" +msgstr "" + #: includes/class-wc-post-types.php:62 includes/class-wc-post-types.php:64 #: includes/widgets/class-wc-widget-product-categories.php:43 msgid "Product Categories" @@ -7416,7 +7415,7 @@ msgid "" "Changing status to draft." msgstr "" -#: includes/class-wc-product-variation.php:683 +#: includes/class-wc-product-variation.php:692 msgid "%s – %s%s" msgstr "" diff --git a/includes/abstracts/abstract-wc-order.php b/includes/abstracts/abstract-wc-order.php index 48afcd87771..4a92b50bef5 100644 --- a/includes/abstracts/abstract-wc-order.php +++ b/includes/abstracts/abstract-wc-order.php @@ -55,7 +55,7 @@ abstract class WC_Abstract_Order { public $post = null; /** @public string Order type */ - public $order_type = 'simple'; + public $order_type = false; /** @public string Order Date */ public $order_date = ''; @@ -1653,11 +1653,9 @@ abstract class WC_Abstract_Order { */ public function get_formatted_order_total() { $formatted_total = wc_price( $this->get_total(), array( 'currency' => $this->get_order_currency() ) ); - return apply_filters( 'woocommerce_get_formatted_order_total', $formatted_total, $this ); } - /** * Gets subtotal - subtotal is shown before discounts, but with localised taxes. * @@ -1903,41 +1901,9 @@ abstract class WC_Abstract_Order { ); } - // Order total display - $order_total = $this->get_total(); - $total_refunded = $this->get_total_refunded(); - $total_string = ''; - $tax_string = ''; - - // Tax for inclusive prices - if ( wc_tax_enabled() && 'incl' == $tax_display ) { - $tax_string_array = array(); - - if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) { - foreach ( $this->get_tax_totals() as $code => $tax ) { - $tax_amount = $total_refunded ? wc_price( WC_Tax::round( $tax->amount - $this->get_total_tax_refunded_by_rate_id( $tax->rate_id ) ), array( 'currency' => $this->get_order_currency() ) ) : $tax->formatted_amount; - $tax_string_array[] = sprintf( '%s %s', $tax_amount, $tax->label ); - } - } else { - $tax_string_array[] = sprintf( '%s %s', wc_price( $this->get_total_tax() - $this->get_total_tax_refunded(), array( 'currency' => $this->get_order_currency() ) ), WC()->countries->tax_or_vat() ); - } - if ( ! empty( $tax_string_array ) ) { - $tax_string = ' ' . sprintf( __( '(Includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ); - } - } - - if ( $total_refunded ) { - $total_string = '' . strip_tags( $this->get_formatted_order_total() ) . ' '; - $total_string .= wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_order_currency() ) ); - $total_string .= $tax_string; - $total_string .= ''; - } else { - $total_string = $this->get_formatted_order_total() . $tax_string; - } - $total_rows['order_total'] = array( 'label' => __( 'Total:', 'woocommerce' ), - 'value' => $total_string + 'value' => $this->get_formatted_order_total( $tax_display ) ); return apply_filters( 'woocommerce_get_order_item_totals', $total_rows, $this ); diff --git a/includes/abstracts/abstract-wc-payment-gateway.php b/includes/abstracts/abstract-wc-payment-gateway.php index 303fe72a2f6..b9af13eb95f 100644 --- a/includes/abstracts/abstract-wc-payment-gateway.php +++ b/includes/abstracts/abstract-wc-payment-gateway.php @@ -205,9 +205,6 @@ abstract class WC_Payment_Gateway extends WC_Settings_API { * Set as current gateway. * * Set this as the current gateway. - * - * @access public - * @return void */ public function set_current() { $this->chosen = true; diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index 318c6b62818..a52794dd139 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -274,7 +274,6 @@ class WC_Product { * set_stock_status function. * * @param string $status - * @return void */ public function set_stock_status( $status ) { @@ -488,7 +487,7 @@ class WC_Product { * @return bool */ public function is_taxable() { - $taxable = $this->tax_status == 'taxable' && wc_tax_enabled() ? true : false; + $taxable = $this->get_tax_status() === 'taxable' && wc_tax_enabled() ? true : false; return apply_filters( 'woocommerce_product_is_taxable', $taxable, $this ); } @@ -498,7 +497,7 @@ class WC_Product { * @return bool */ public function is_shipping_taxable() { - return $this->tax_status=='taxable' || $this->tax_status=='shipping' ? true : false; + return $this->get_tax_status() === 'taxable' || $this->get_tax_status() === 'shipping' ? true : false; } /** @@ -755,7 +754,6 @@ class WC_Product { * Set a products price dynamically. * * @param float $price Price to set. - * @return void */ public function set_price( $price ) { $this->price = $price; @@ -765,7 +763,6 @@ class WC_Product { * Adjust a products price dynamically. * * @param mixed $price - * @return void */ public function adjust_price( $price ) { $this->price = $this->price + $price; diff --git a/includes/abstracts/abstract-wc-session.php b/includes/abstracts/abstract-wc-session.php index 6cf0d656c8e..2817f45d069 100644 --- a/includes/abstracts/abstract-wc-session.php +++ b/includes/abstracts/abstract-wc-session.php @@ -53,7 +53,6 @@ abstract class WC_Session { * __unset function. * * @param mixed $key - * @return void */ public function __unset( $key ) { if ( isset( $this->_data[ $key ] ) ) { diff --git a/includes/abstracts/abstract-wc-widget.php b/includes/abstracts/abstract-wc-widget.php index b081baeacc6..e71cfd0f40d 100644 --- a/includes/abstracts/abstract-wc-widget.php +++ b/includes/abstracts/abstract-wc-widget.php @@ -96,8 +96,6 @@ abstract class WC_Widget extends WP_Widget { /** * Flush the cache - * - * @return void */ public function flush_widget_cache() { wp_cache_delete( apply_filters( 'woocommerce_cached_widget_id', $this->widget_id ), 'widget' ); diff --git a/includes/admin/class-wc-admin-api-keys-table-list.php b/includes/admin/class-wc-admin-api-keys-table-list.php index 0301c2ba83e..afb27cd6a96 100644 --- a/includes/admin/class-wc-admin-api-keys-table-list.php +++ b/includes/admin/class-wc-admin-api-keys-table-list.php @@ -36,10 +36,12 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table { */ public function get_columns() { return array( - 'cb' => '', - 'description' => __( 'Description', 'woocommerce' ), - 'user' => __( 'User', 'woocommerce' ), - 'permissions' => __( 'Permissions', 'woocommerce' ) + 'cb' => '', + 'description' => __( 'Description', 'woocommerce' ), + 'truncated_key' => __( 'Consumer Key Ending In', 'woocommerce' ), + 'user' => __( 'User', 'woocommerce' ), + 'permissions' => __( 'Permissions', 'woocommerce' ), + 'last_access' => __( 'Last Access', 'woocommerce' ) ); } @@ -63,7 +65,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table { $url = admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys&edit-key=' . $key['key_id'] ); $output = ''; - $output .= ''; + $output .= ''; if ( empty( $key['description'] ) ) { $output .= esc_html__( 'API Key', 'woocommerce' ); } else { @@ -90,6 +92,16 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table { return $output; } + /** + * Return truncated consumer key column + * + * @param array $key + * @return string + */ + public function column_truncated_key( $key ) { + return '…' . esc_html( $key['truncated_key'] ) . ''; + } + /** * Return user column * @@ -133,6 +145,22 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table { } } + /** + * Return last access column + * + * @param array $key + * @return string + */ + public function column_last_access( $key ) { + if ( ! empty( $key['last_access'] ) ) { + $date = sprintf( _x( '%1$s at %2$s', 'date and time', 'woocommerce' ), date_i18n( wc_date_format(), strtotime( $key['last_access'] ) ), date_i18n( wc_time_format(), strtotime( $key['last_access'] ) ) ); + + return apply_filters( 'woocommerce_api_key_last_access_datetime', $date, $key['last_access'] ); + } + + return __( 'Unknown' ); + } + /** * Get bulk actions * @@ -172,7 +200,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table { // Get the API keys $keys = $wpdb->get_results( $wpdb->prepare( " - SELECT * + SELECT key_id, user_id, description, permissions, truncated_key, last_access FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 $search @@ -181,7 +209,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table { OFFSET %d ", $per_page, $offset ), ARRAY_A ); - $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 $search" ); + $count = $wpdb->get_var( "SELECT COUNT(key_id) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 $search" ); $this->items = $keys; diff --git a/includes/admin/class-wc-admin-api-keys.php b/includes/admin/class-wc-admin-api-keys.php index 5868b3edd99..a446ead2776 100644 --- a/includes/admin/class-wc-admin-api-keys.php +++ b/includes/admin/class-wc-admin-api-keys.php @@ -83,12 +83,12 @@ class WC_Admin_API_Keys { global $wpdb; $empty = array( - 'key_id' => 0, - 'user_id' => '', - 'description' => '', - 'permissions' => '', - 'consumer_key' => '', - 'consumer_secret' => '' + 'key_id' => 0, + 'user_id' => '', + 'description' => '', + 'permissions' => '', + 'truncated_key' => '', + 'last_access' => '' ); if ( 0 == $key_id ) { @@ -96,7 +96,7 @@ class WC_Admin_API_Keys { } $key = $wpdb->get_row( $wpdb->prepare( " - SELECT key_id, user_id, description, permissions, consumer_key, consumer_secret + SELECT key_id, user_id, description, permissions, truncated_key, last_access FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d ", $key_id ), ARRAY_A ); diff --git a/includes/admin/class-wc-admin-assets.php b/includes/admin/class-wc-admin-assets.php index b2f7aeff3d1..9ad52ebb8d2 100644 --- a/includes/admin/class-wc-admin-assets.php +++ b/includes/admin/class-wc-admin-assets.php @@ -90,6 +90,7 @@ class WC_Admin_Assets { wp_register_script( 'zeroclipboard', WC()->plugin_url() . '/assets/js/zeroclipboard/jquery.zeroclipboard' . $suffix . '.js', array( 'jquery' ), WC_VERSION ); wp_register_script( 'qrcode', WC()->plugin_url() . '/assets/js/jquery-qrcode/jquery.qrcode' . $suffix . '.js', array( 'jquery' ), WC_VERSION ); wp_register_script( 'stupidtable', WC()->plugin_url() . '/assets/js/stupidtable/stupidtable' . $suffix . '.js', array( 'jquery' ), WC_VERSION ); + wp_register_script( 'serializejson', WC()->plugin_url() . '/assets/js/jquery-serializejson/jquery.serializejson' . $suffix . '.js', array( 'jquery' ), '2.6.1' ); // Chosen is @deprecated (2.3) in favour of select2, but is registered for backwards compat wp_register_script( 'ajax-chosen', WC()->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery' . $suffix . '.js', array( 'jquery', 'chosen' ), WC_VERSION ); @@ -159,7 +160,7 @@ class WC_Admin_Assets { if ( in_array( $screen->id, array( 'product', 'edit-product' ) ) ) { wp_enqueue_media(); wp_enqueue_script( 'wc-admin-product-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product' . $suffix . '.js', array( 'wc-admin-meta-boxes' ), WC_VERSION ); - wp_enqueue_script( 'wc-admin-variation-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product-variation' . $suffix . '.js', array( 'wc-admin-meta-boxes' ), WC_VERSION ); + wp_enqueue_script( 'wc-admin-variation-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product-variation' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'serializejson' ), WC_VERSION ); $params = array( 'post_id' => isset( $post->ID ) ? $post->ID : '', diff --git a/includes/admin/class-wc-admin-help.php b/includes/admin/class-wc-admin-help.php index 021c1cbf4b2..78a8a81bada 100644 --- a/includes/admin/class-wc-admin-help.php +++ b/includes/admin/class-wc-admin-help.php @@ -69,7 +69,7 @@ class WC_Admin_Help { 'title' => __( 'Email Settings', 'woocommerce' ), 'url' => '//fast.wistia.net/embed/iframe/svcaftq4xv?videoFoam=true' ), - 'wc-settings-webhooks' => array( + 'wc-settings-api' => array( 'title' => __( 'Webhook Settings', 'woocommerce' ), 'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq?videoFoam=true' ), @@ -109,7 +109,7 @@ class WC_Admin_Help { 'title' => __( 'Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce' ), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true' ), - 'product_page_product_attributes' => array( + 'product_attributes' => array( 'title' => __( 'Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce' ), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true' ), diff --git a/includes/admin/class-wc-admin-notices.php b/includes/admin/class-wc-admin-notices.php index 0500b389eee..4855c1f70f9 100644 --- a/includes/admin/class-wc-admin-notices.php +++ b/includes/admin/class-wc-admin-notices.php @@ -159,8 +159,13 @@ class WC_Admin_Notices { */ public function translation_upgrade_notice() { $screen = get_current_screen(); + $locale = get_locale(); - if ( 'update-core' !== $screen->id ) { + if ( 'en_US' === $locale ) { + self::hide_translation_upgrade_notice(); + } + + if ( 'update-core' !== $screen->id && 'en_US' !== $locale ) { include( 'views/html-notice-translation-upgrade.php' ); } } diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index 72ada9dfadd..6ad6872d73e 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -453,7 +453,7 @@ class WC_Admin_Post_Types { $title = _draft_or_post_title(); $post_type_object = get_post_type_object( $post->post_type ); - echo '' . esc_html( $title ). ''; + echo '' . esc_html( $title ). ''; _post_states( $post ); @@ -703,7 +703,7 @@ class WC_Admin_Post_Types { } } - printf( _x( '%s by %s', 'Order number by X', 'woocommerce' ), '#' . esc_attr( $the_order->get_order_number() ) . '', $username ); + printf( _x( '%s by %s', 'Order number by X', 'woocommerce' ), '#' . esc_attr( $the_order->get_order_number() ) . '', $username ); if ( $the_order->billing_email ) { echo ''; diff --git a/includes/admin/class-wc-admin-settings.php b/includes/admin/class-wc-admin-settings.php index ba2874415db..7dc563463b2 100644 --- a/includes/admin/class-wc-admin-settings.php +++ b/includes/admin/class-wc-admin-settings.php @@ -710,7 +710,11 @@ class WC_Admin_Settings { * Fire an action when a certain 'type' of field is being saved. * @deprecated 2.4.0 - doesn't allow manipulation of values! */ - do_action( 'woocommerce_update_option_' . sanitize_title( $option['type'] ), $option ); + if ( has_action( 'woocommerce_update_option_' . sanitize_title( $option['type'] ) ) ) { + _deprecated_function( 'The woocommerce_update_option_X action', '2.4.0', 'woocommerce_admin_settings_sanitize_option filter' ); + do_action( 'woocommerce_update_option_' . sanitize_title( $option['type'] ), $option ); + continue; + } /** * Sanitize the value of an option diff --git a/includes/admin/class-wc-admin-setup-wizard.php b/includes/admin/class-wc-admin-setup-wizard.php index 86175e366f2..2b734967e8f 100644 --- a/includes/admin/class-wc-admin-setup-wizard.php +++ b/includes/admin/class-wc-admin-setup-wizard.php @@ -608,7 +608,7 @@ class WC_Admin_Setup_Wizard { 'tax_rate_order' => $loop ++, 'tax_rate_class' => '' ); - $tax_rate_id = WC_Tax::_insert_tax_rate( $tax_rate ); + WC_Tax::_insert_tax_rate( $tax_rate ); } } } diff --git a/includes/admin/class-wc-admin-webhooks-table-list.php b/includes/admin/class-wc-admin-webhooks-table-list.php index c44f3fc1a4e..725d50bd479 100644 --- a/includes/admin/class-wc-admin-webhooks-table-list.php +++ b/includes/admin/class-wc-admin-webhooks-table-list.php @@ -86,7 +86,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table { if ( 'trash' == $post_status ) { $output .= esc_html( $title ); } else { - $output .= '' . esc_html( $title ) . ''; + $output .= '' . esc_html( $title ) . ''; } $output .= ''; diff --git a/includes/admin/importers/class-wc-tax-rate-importer.php b/includes/admin/importers/class-wc-tax-rate-importer.php index 6fac7b2cd66..4e24bfaabd0 100644 --- a/includes/admin/importers/class-wc-tax-rate-importer.php +++ b/includes/admin/importers/class-wc-tax-rate-importer.php @@ -75,7 +75,9 @@ class WC_Tax_Rate_Importer extends WP_Importer { if ( function_exists( 'gc_enable' ) ) { gc_enable(); } - @set_time_limit(0); + if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { + set_time_limit( 0 ); + } @ob_flush(); @flush(); @ini_set( 'auto_detect_line_endings', '1' ); diff --git a/includes/admin/meta-boxes/class-wc-meta-box-product-data.php b/includes/admin/meta-boxes/class-wc-meta-box-product-data.php index 04bce839e5e..9aa6bcddd06 100644 --- a/includes/admin/meta-boxes/class-wc-meta-box-product-data.php +++ b/includes/admin/meta-boxes/class-wc-meta-box-product-data.php @@ -507,16 +507,19 @@ class WC_Meta_Box_Product_Data {

- - + ' src="plugin_url(); ?>/assets/images/help.png" height="16" width="16" /> + if ( $parent_id ) { + $parent = wc_get_product( $parent_id ); + if ( is_object( $parent ) ) { + $parent_title = wp_kses_post( html_entity_decode( $parent->get_formatted_name() ) ); + } + + echo esc_attr( $parent_title ); + } + ?>" value="" /> ' src="plugin_url(); ?>/assets/images/help.png" height="16" width="16" />

@@ -898,6 +901,19 @@ class WC_Meta_Box_Product_Data { // Update post terms if ( taxonomy_exists( $attribute_names[ $i ] ) ) { + + foreach( $values as $key => $value ) { + $term = get_term_by( 'name', trim( $value ), $attribute_names[ $i ] ); + if ( $term ) { + $values[ $key ] = intval( $term->term_id ); + } else { + $term = wp_insert_term( trim( $value ), $attribute_names[ $i ] ); + if ( isset( $term->term_id ) ) { + $values[ $key ] = intval($term->term_id); + } + } + } + wp_set_object_terms( $post_id, $values, $attribute_names[ $i ] ); } diff --git a/includes/admin/settings/class-wc-settings-checkout.php b/includes/admin/settings/class-wc-settings-checkout.php index 60fdc82aca5..90a50ba7686 100644 --- a/includes/admin/settings/class-wc-settings-checkout.php +++ b/includes/admin/settings/class-wc-settings-checkout.php @@ -252,8 +252,6 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page { payment_gateways->payment_gateways() as $gateway ) { echo ''; diff --git a/includes/admin/settings/views/html-keys-edit.php b/includes/admin/settings/views/html-keys-edit.php index ace5dd4eccc..cf60d345bdb 100644 --- a/includes/admin/settings/views/html-keys-edit.php +++ b/includes/admin/settings/views/html-keys-edit.php @@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) { $curent_user_id = get_current_user_id(); $user_id = ! empty( $key_data['user_id'] ) ? absint( $key_data['user_id'] ) : $curent_user_id; $user = get_user_by( 'id', $user_id ); - $user_string = esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' – ' . esc_html( $user->user_email ); + $user_string = esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' – ' . esc_html( $user->user_email ) . ')'; ?> @@ -55,6 +55,33 @@ if ( ! defined( 'ABSPATH' ) ) { + + + + + + + + + + + + + + + + + + + @@ -87,7 +114,7 @@ if ( ! defined( 'ABSPATH' ) ) { - + <%- consumer_secret %> diff --git a/includes/admin/views/html-admin-page-status-report.php b/includes/admin/views/html-admin-page-status-report.php index 6acb7494a26..270af82c313 100644 --- a/includes/admin/views/html-admin-page-status-report.php +++ b/includes/admin/views/html-admin-page-status-report.php @@ -687,7 +687,7 @@ if ( ! defined( 'ABSPATH' ) ) { $theme_file = false; } - if ( $theme_file ) { + if ( ! empty( $theme_file ) ) { $core_version = WC_Admin_Status::get_file_version( WC()->plugin_path() . '/templates/' . $file ); $theme_version = WC_Admin_Status::get_file_version( $theme_file ); diff --git a/includes/admin/views/html-notice-frontend-colors.php b/includes/admin/views/html-notice-frontend-colors.php deleted file mode 100644 index 479e8448c88..00000000000 --- a/includes/admin/views/html-notice-frontend-colors.php +++ /dev/null @@ -1,22 +0,0 @@ - -
-

The Frontend Style options are deprecated – If you want to continue editing the colors of your store we recommended that you install the replacement WooCommerce Colors plugin from WordPress.org.', 'woocommerce' ); ?>

-

-
diff --git a/includes/admin/views/html-notice-install.php b/includes/admin/views/html-notice-install.php index e3d8c5d6765..16c569931a6 100644 --- a/includes/admin/views/html-notice-install.php +++ b/includes/admin/views/html-notice-install.php @@ -10,5 +10,5 @@ if ( ! defined( 'ABSPATH' ) ) { ?>

Welcome to WooCommerce – You‘re almost ready to start selling :)', 'woocommerce' ); ?>

-

+

diff --git a/includes/admin/views/html-notice-template-check.php b/includes/admin/views/html-notice-template-check.php index 2ecca7a6137..f996f0fa39a 100644 --- a/includes/admin/views/html-notice-template-check.php +++ b/includes/admin/views/html-notice-template-check.php @@ -11,5 +11,5 @@ $theme = wp_get_theme(); ?>

Your theme (%s) contains outdated copies of some WooCommerce template files. These files may need updating to ensure they are compatible with the current version of WooCommerce. You can see which files are affected from the %ssystem status page%s. If in doubt, check with the author of the theme.', 'woocommerce' ), esc_html( $theme['Name'] ), '', '' ); ?>

-

+

diff --git a/includes/admin/views/html-notice-theme-support.php b/includes/admin/views/html-notice-theme-support.php index 830e87f49c6..71257765974 100644 --- a/includes/admin/views/html-notice-theme-support.php +++ b/includes/admin/views/html-notice-theme-support.php @@ -13,6 +13,6 @@ if ( ! defined( 'ABSPATH' ) ) {

- +

diff --git a/includes/admin/views/html-notice-update.php b/includes/admin/views/html-notice-update.php index 587a034dbb0..018493e1764 100644 --- a/includes/admin/views/html-notice-update.php +++ b/includes/admin/views/html-notice-update.php @@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {