Merge branch 'master' of github.com:woothemes/woocommerce

This commit is contained in:
Nicola Mustone 2015-07-20 16:22:07 +02:00
commit 77c01104a0
113 changed files with 1356 additions and 915 deletions

View File

@ -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
sensiolabs_security_checker: true

View File

@ -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.

View File

@ -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'],

View File

@ -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 ) ) {

File diff suppressed because one or more lines are too long

View File

@ -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( '<p class="wc-no-matching-variations woocommerce-info">' + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + '</p>' );
$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( '<div class="woocommerce-variation-description">' + variation.variation_description + '</div>' );
}
$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 );
})( jQuery, window, document );

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,267 @@
/*!
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 ($) {
"use strict";
// jQuery('form').serializeJSON()
$.fn.serializeJSON = function (options) {
var serializedObject, formAsArray, keys, type, value, _ref, f, opts;
f = $.serializeJSON;
opts = f.setupOpts(options); // calculate values for options {parseNumbers, parseBoolens, parseNulls}
formAsArray = this.serializeArray(); // array of objects {name, value}
f.readCheckboxUncheckedValues(formAsArray, this, opts); // add {name, value} of unchecked checkboxes if needed
serializedObject = {};
$.each(formAsArray, function (i, input) {
keys = f.splitInputNameIntoKeysArray(input.name, opts);
type = keys.pop(); // the last element is always the type ("string" by default)
if (type !== 'skip') { // easy way to skip a value
value = f.parseValue(input.value, type, opts); // string, number, boolean or null
if (opts.parseWithFunction && type === '_') { // allow for custom parsing
value = opts.parseWithFunction(value, input.name);
}
f.deepSet(serializedObject, keys, value, opts);
}
});
return serializedObject;
};
// Use $.serializeJSON as namespace for the auxiliar functions
// and to define defaults
$.serializeJSON = {
defaultOptions: {
checkboxUncheckedValue: undefined, // to include that value for unchecked checkboxes (instead of ignoring them)
parseNumbers: false, // convert values like "1", "-2.33" to 1, -2.33
parseBooleans: false, // convert "true", "false" to true, false
parseNulls: false, // convert "null" to null
parseAll: false, // all of the above
parseWithFunction: null, // to use custom parser, a function like: function(val){ return parsed_val; }
customTypes: {}, // override defaultTypes
defaultTypes: {
"string": function(str) { return String(str); },
"number": function(str) { return Number(str); },
"boolean": function(str) { var falses = ["false", "null", "undefined", "", "0"]; return falses.indexOf(str) === -1; },
"null": function(str) { var falses = ["false", "null", "undefined", "", "0"]; return falses.indexOf(str) === -1 ? str : null; },
"array": function(str) { return JSON.parse(str); },
"object": function(str) { return JSON.parse(str); },
"auto": function(str) { return $.serializeJSON.parseValue(str, null, {parseNumbers: true, parseBooleans: true, parseNulls: true}); } // try again with something like "parseAll"
},
useIntKeysAsArrayIndex: false // name="foo[2]" value="v" => {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.$));

View File

@ -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.$);

View File

@ -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&hellip;"
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 <strong>%s</strong> 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). "
"<a href=\"%s\">Click here to download a sample</a>."
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 ""
"<strong>The Frontend Style options are deprecated</strong> &#8211; 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 ""
"<strong>Welcome to WooCommerce</strong> &#8211; You&lsquo;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&hellip;"
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&hellip;"

View File

@ -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 "&nbsp;<small>%svia %s</small>"
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 <strong>database caching</strong> to work with WooCommerce you "
"must add <code>_wc_session_</code> 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 &ndash; %s%s"
msgstr ""

View File

@ -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 = '<del>' . strip_tags( $this->get_formatted_order_total() ) . '</del> <ins>';
$total_string .= wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_order_currency() ) );
$total_string .= $tax_string;
$total_string .= '</ins>';
} 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 );

View File

@ -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;

View File

@ -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;

View File

@ -53,7 +53,6 @@ abstract class WC_Session {
* __unset function.
*
* @param mixed $key
* @return void
*/
public function __unset( $key ) {
if ( isset( $this->_data[ $key ] ) ) {

View File

@ -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' );

View File

@ -36,10 +36,12 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
*/
public function get_columns() {
return array(
'cb' => '<input type="checkbox" />',
'description' => __( 'Description', 'woocommerce' ),
'user' => __( 'User', 'woocommerce' ),
'permissions' => __( 'Permissions', 'woocommerce' )
'cb' => '<input type="checkbox" />',
'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&section=keys&edit-key=' . $key['key_id'] );
$output = '<strong>';
$output .= '<a href="' . esc_url( $url ) . '">';
$output .= '<a href="' . esc_url( $url ) . '" class="row-title">';
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 '<code>&hellip;' . esc_html( $key['truncated_key'] ) . '</code>';
}
/**
* 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;

View File

@ -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 );

View File

@ -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 : '',

View File

@ -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, &amp; 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, &amp; Attributes', 'woocommerce' ),
'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'
),

View File

@ -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' );
}
}

View File

@ -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 '<a href="' . esc_attr( $edit_link ) . '">' . esc_html( $title ). '</a>';
echo '<strong><a href="' . esc_attr( $edit_link ) . '" class="row-title">' . esc_html( $title ). '</a></strong>';
_post_states( $post );
@ -703,7 +703,7 @@ class WC_Admin_Post_Types {
}
}
printf( _x( '%s by %s', 'Order number by X', 'woocommerce' ), '<a href="' . admin_url( 'post.php?post=' . absint( $post->ID ) . '&action=edit' ) . '"><strong>#' . esc_attr( $the_order->get_order_number() ) . '</strong></a>', $username );
printf( _x( '%s by %s', 'Order number by X', 'woocommerce' ), '<a href="' . admin_url( 'post.php?post=' . absint( $post->ID ) . '&action=edit' ) . '" class="row-title"><strong>#' . esc_attr( $the_order->get_order_number() ) . '</strong></a>', $username );
if ( $the_order->billing_email ) {
echo '<small class="meta email"><a href="' . esc_url( 'mailto:' . $the_order->billing_email ) . '">' . esc_html( $the_order->billing_email ) . '</a></small>';

View File

@ -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

View File

@ -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 );
}
}
}

View File

@ -86,7 +86,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
if ( 'trash' == $post_status ) {
$output .= esc_html( $title );
} else {
$output .= '<a href="' . esc_url( $edit_link ) . '">' . esc_html( $title ) . '</a>';
$output .= '<a href="' . esc_url( $edit_link ) . '" class="row-title">' . esc_html( $title ) . '</a>';
}
$output .= '</strong>';

View File

@ -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' );

View File

@ -507,16 +507,19 @@ class WC_Meta_Box_Product_Data {
<div class="options_group grouping show_if_simple show_if_external">
<p class="form-field">
<label for="parent_id"><?php _e( 'Cross-Sells', 'woocommerce' ); ?></label>
<input type="hidden" class="wc-product-search" style="width: 50%;" id="parent_id" name="parent_id" data-placeholder="<?php _e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_grouped_products" data-multiple="false" data-selected="<?php
<label for="parent_id"><?php _e( 'Grouping', 'woocommerce' ); ?></label>
<input type="hidden" class="wc-product-search" style="width: 50%;" id="parent_id" name="parent_id" data-placeholder="<?php _e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_grouped_products" data-allow_clear="true" data-multiple="false" data-selected="<?php
$parent_id = absint( $post->post_parent );
$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="<?php echo $parent_id; ?>" /> <img class="help_tip" data-tip='<?php _e( 'Set this option to make this product part of a grouped product.', 'woocommerce' ) ?>' src="<?php echo WC()->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="<?php echo $parent_id ? $parent_id : ''; ?>" /> <img class="help_tip" data-tip='<?php _e( 'Set this option to make this product part of a grouped product.', 'woocommerce' ) ?>' src="<?php echo WC()->plugin_url(); ?>/assets/images/help.png" height="16" width="16" />
</p>
<?php
@ -654,7 +657,7 @@ class WC_Meta_Box_Product_Data {
<div class="toolbar toolbar-top">
<select id="field_to_edit" class="variation_actions">
<option value="add_variation"><?php _e( 'Add Variation', 'woocommerce' ); ?></option>
<option value="add_variation"><?php _e( 'Add variation', 'woocommerce' ); ?></option>
<option value="link_all_variations"><?php _e( 'Create variations from all attributes', 'woocommerce' ); ?></option>
<option value="delete_all"><?php _e( 'Delete all variations', 'woocommerce' ); ?></option>
<optgroup label="<?php esc_attr_e( 'Status', 'woocommerce' ); ?>">
@ -663,13 +666,13 @@ class WC_Meta_Box_Product_Data {
<option value="toggle_virtual"><?php _e( 'Toggle &quot;Virtual&quot;', 'woocommerce' ); ?></option>
</optgroup>
<optgroup label="<?php esc_attr_e( 'Pricing', 'woocommerce' ); ?>">
<option value="variable_regular_price"><?php _e( 'Prices', 'woocommerce' ); ?></option>
<option value="variable_regular_price_increase"><?php _e( 'Prices increase by (fixed amount or %)', 'woocommerce' ); ?></option>
<option value="variable_regular_price_decrease"><?php _e( 'Prices decrease by (fixed amount or %)', 'woocommerce' ); ?></option>
<option value="variable_sale_price"><?php _e( 'Sale prices', 'woocommerce' ); ?></option>
<option value="variable_sale_price_increase"><?php _e( 'Sale prices increase by (fixed amount or %)', 'woocommerce' ); ?></option>
<option value="variable_sale_price_decrease"><?php _e( 'Sale prices decrease by (fixed amount or %)', 'woocommerce' ); ?></option>
<option value="variable_sale_schedule"><?php _e( 'Scheduled sale dates', 'woocommerce' ); ?></option>
<option value="variable_regular_price"><?php _e( 'Set regular prices', 'woocommerce' ); ?></option>
<option value="variable_regular_price_increase"><?php _e( 'Increase regular prices (fixed amount or percentage)', 'woocommerce' ); ?></option>
<option value="variable_regular_price_decrease"><?php _e( 'Decrease regular prices (fixed amount or percentage)', 'woocommerce' ); ?></option>
<option value="variable_sale_price"><?php _e( 'Set sale prices', 'woocommerce' ); ?></option>
<option value="variable_sale_price_increase"><?php _e( 'Increase sale prices (fixed amount or percentage)', 'woocommerce' ); ?></option>
<option value="variable_sale_price_decrease"><?php _e( 'Decrease sale prices (fixed amount or percentage)', 'woocommerce' ); ?></option>
<option value="variable_sale_schedule"><?php _e( 'Set scheduled sale dates', 'woocommerce' ); ?></option>
</optgroup>
<optgroup label="<?php esc_attr_e( 'Inventory', 'woocommerce' ); ?>">
<option value="toggle_manage_stock"><?php _e( 'Toggle &quot;Manage stock&quot;', 'woocommerce' ); ?></option>
@ -683,7 +686,7 @@ class WC_Meta_Box_Product_Data {
</optgroup>
<optgroup label="<?php esc_attr_e( 'Downloadable products', 'woocommerce' ); ?>">
<option value="variable_download_limit"><?php _e( 'Download limit', 'woocommerce' ); ?></option>
<option value="variable_download_expiry"><?php _e( 'Download Expiry', 'woocommerce' ); ?></option>
<option value="variable_download_expiry"><?php _e( 'Download expiry', 'woocommerce' ); ?></option>
</optgroup>
<?php do_action( 'woocommerce_variable_product_bulk_edit_actions' ); ?>
</select>
@ -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 ] );
}

View File

@ -252,8 +252,6 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
</thead>
<tbody>
<?php
$default_gateway = get_option( 'woocommerce_default_gateway' );
foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) {
echo '<tr>';

View File

@ -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 ) . ' &ndash; ' . esc_html( $user->user_email );
$user_string = esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' &ndash; ' . esc_html( $user->user_email ) . ')';
?>
<input type="hidden" class="wc-customer-search" id="key_user" data-placeholder="<?php esc_html_e( 'Search for a customer&hellip;', 'woocommerce' ); ?>" data-selected="<?php echo esc_attr( $user_string ); ?>" value="<?php echo esc_attr( $user_id ); ?>" data-allow_clear="true" />
</td>
@ -55,6 +55,33 @@ if ( ! defined( 'ABSPATH' ) ) {
</select>
</td>
</tr>
<?php if ( 0 !== $key_id ) : ?>
<tr valign="top">
<th scope="row" class="titledesc">
<?php _e( 'Consumer Key Ending In', 'woocommerce' ); ?>
</th>
<td class="forminp">
<code>&hellip;<?php echo esc_html( $key_data['truncated_key'] ); ?></code>
</td>
</tr>
<tr valign="top">
<th scope="row" class="titledesc">
<?php _e( 'Last Access', 'woocommerce' ); ?>
</th>
<td class="forminp">
<span><?php
if ( ! empty( $key_data['last_access'] ) ) {
$date = sprintf( _x( '%1$s at %2$s', 'date and time', 'woocommerce' ), date_i18n( wc_date_format(), strtotime( $key_data['last_access'] ) ), date_i18n( wc_time_format(), strtotime( $key_data['last_access'] ) ) );
echo apply_filters( 'woocommerce_api_key_last_access_datetime', $date, $key_data['last_access'] );
} else {
_e( 'Unknown', 'woocommerce' );
}
?></span>
</td>
</tr>
<?php endif ?>
</tbody>
</table>
@ -87,7 +114,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="key_consumer_secret"><?php _e( 'Consumer Secret', 'woocommerce' ); ?></label>
<?php _e( 'Consumer Secret', 'woocommerce' ); ?>
</th>
<td class="forminp">
<code id="key_consumer_secret"><%- consumer_secret %></code> <button type="button" class="button-secondary copy-key" data-tip="<?php _e( 'Copied!', 'woocommerce' ); ?>"><?php _e( 'Copy', 'woocommerce' ); ?></button>

View File

@ -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 );

View File

@ -1,22 +0,0 @@
<?php
/**
* Admin View: Notice - Frontend Colors
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$plugin_slug = 'woocommerce-colors';
if ( current_user_can( 'install_plugins' ) ) {
$url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug ), 'install-plugin_' . $plugin_slug );
} else {
$url = 'http://wordpress.org/plugins/' . $plugin_slug;
}
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php _e( '<strong>The Frontend Style options are deprecated</strong> &#8211; 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' ); ?></p>
<p class="submit"><a href="<?php echo esc_url( $url ); ?>" class="wc-update-now button-primary"><?php _e( 'Install the new WooCommerce Colors plugin', 'woocommerce' ); ?></a> <a class="skip button" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'frontend_colors' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Hide this notice', 'woocommerce' ); ?></a></p>
</div>

View File

@ -10,5 +10,5 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php _e( '<strong>Welcome to WooCommerce</strong> &#8211; You&lsquo;re almost ready to start selling :)', 'woocommerce' ); ?></p>
<p class="submit"><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-setup' ) ); ?>" class="button-primary"><?php _e( 'Run the Setup Wizard', 'woocommerce' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'install' ) ); ?>"><?php _e( 'Skip Setup', 'woocommerce' ); ?></a></p>
<p class="submit"><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-setup' ) ); ?>" class="button-primary"><?php _e( 'Run the Setup Wizard', 'woocommerce' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'install' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Skip Setup', 'woocommerce' ); ?></a></p>
</div>

View File

@ -11,5 +11,5 @@ $theme = wp_get_theme();
?>
<div id="message" class="updated woocommerce-message">
<p><?php printf( __( '<strong>Your theme (%s) contains outdated copies of some WooCommerce template files.</strong> 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'] ), '<a href="' . esc_url( admin_url( 'admin.php?page=wc-status' ) ) . '">', '</a>' ); ?></p>
<p class="submit"><a class="button-secondary" href="http://docs.woothemes.com/document/template-structure/"><?php _e( 'Learn More About Templates', 'woocommerce' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'template_files' ) ); ?>"><?php _e( 'Hide This Notice', 'woocommerce' ); ?></a></p>
<p class="submit"><a class="button-primary" href="http://docs.woothemes.com/document/template-structure/" target="_blank"><?php _e( 'Learn More About Templates', 'woocommerce' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'template_files' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Hide This Notice', 'woocommerce' ); ?></a></p>
</div>

View File

@ -13,6 +13,6 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="submit">
<a href="http://www.woothemes.com/storefront/?utm_source=wpadmin&amp;utm_medium=notice&amp;utm_campaign=Storefront" class="button-primary" target="_blank"><?php _e( 'Read More About Storefront', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'http://docs.woothemes.com/document/third-party-custom-theme-compatibility/', 'theme-compatibility' ) ); ?>" class="button-secondary" target="_blank"><?php _e( 'Theme Integration Guide', 'woocommerce' ); ?></a>
<a class="button-secondary skip" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'theme_support' ) ); ?>"><?php _e( 'Hide This Notice', 'woocommerce' ); ?></a>
<a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'theme_support' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Hide This Notice', 'woocommerce' ); ?></a>
</p>
</div>

View File

@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="submit"><a href="<?php echo esc_url( add_query_arg( 'do_update_woocommerce', 'true', admin_url( 'admin.php?page=wc-settings' ) ) ); ?>" class="wc-update-now button-primary"><?php _e( 'Run the updater', 'woocommerce' ); ?></a></p>
</div>
<script type="text/javascript">
jQuery('.wc-update-now').click('click', function(){
jQuery( '.wc-update-now' ).click( 'click', function() {
var answer = confirm( '<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'woocommerce' ); ?>' );
return answer;
});

View File

@ -53,6 +53,8 @@ class WC_API_Authentication {
$user = $this->get_user_by_id( $keys['user_id'] );
$this->update_api_key_last_access( $keys['key_id'] );
} catch ( Exception $e ) {
$user = new WP_Error( 'woocommerce_api_authentication_error', $e->getMessage(), array( 'status' => $e->getCode() ) );
}
@ -169,7 +171,7 @@ class WC_API_Authentication {
$consumer_key = wc_api_hash( sanitize_text_field( $consumer_key ) );
$keys = $wpdb->get_row( $wpdb->prepare( "
SELECT *
SELECT key_id, user_id, permissions, consumer_key, consumer_secret, nonces
FROM {$wpdb->prefix}woocommerce_api_keys
WHERE consumer_key = '%s'
", $consumer_key ), ARRAY_A );
@ -389,4 +391,23 @@ class WC_API_Authentication {
break;
}
}
/**
* Updated API Key last access datetime
*
* @since 2.4.0
*
* @param int $key_id
*/
private function update_api_key_last_access( $key_id ) {
global $wpdb;
$wpdb->update(
$wpdb->prefix . 'woocommerce_api_keys',
array( 'last_access' => current_time( 'mysql' ) ),
array( 'key_id' => $key_id ),
array( '%s' ),
array( '%d' )
);
}
}

View File

@ -299,7 +299,6 @@ class WC_API_Customers extends WC_API_Resource {
* @since 2.2
* @param int $id the customer ID
* @param array $data
* @return void
*/
protected function update_customer_data( $id, $data ) {
// Customer first name.

View File

@ -980,10 +980,11 @@ class WC_API_Orders extends WC_API_Resource {
* Given a product ID & API provided variations, find the correct variation ID to use for calculation
* We can't just trust input from the API to pass a variation_id manually, otherwise you could pass
* the cheapest variation ID but provide other information so we have to look up the variation ID.
* @param int $product_id main product ID
* @return int returns an ID if a valid variation was found for this product
*
* @param WC_Product $product Product instance
* @return int Returns an ID if a valid variation was found for this product
*/
function get_variation_id( $product, $variations = array() ) {
public function get_variation_id( $product, $variations = array() ) {
$variation_id = null;
$variations_normalized = array();

View File

@ -1538,7 +1538,6 @@ class WC_API_Products extends WC_API_Resource {
* @since 2.2
* @param int $id
* @param array $data
* @return void
*/
private function save_product_shipping_data( $id, $data ) {
if ( isset( $data['weight'] ) ) {
@ -1588,7 +1587,6 @@ class WC_API_Products extends WC_API_Resource {
* @param int $product_id
* @param array $downloads
* @param int $variation_id
* @return void
*/
private function save_downloadable_files( $product_id, $downloads, $variation_id = 0 ) {
$files = array();

View File

@ -54,6 +54,8 @@ class WC_API_Authentication {
$user = $this->get_user_by_id( $keys['user_id'] );
$this->update_api_key_last_access( $keys['key_id'] );
} catch ( Exception $e ) {
$user = new WP_Error( 'woocommerce_api_authentication_error', $e->getMessage(), array( 'status' => $e->getCode() ) );
}
@ -172,7 +174,7 @@ class WC_API_Authentication {
$consumer_key = wc_api_hash( sanitize_text_field( $consumer_key ) );
$keys = $wpdb->get_row( $wpdb->prepare( "
SELECT *
SELECT key_id, user_id, permissions, consumer_key, consumer_secret, nonces
FROM {$wpdb->prefix}woocommerce_api_keys
WHERE consumer_key = '%s'
", $consumer_key ), ARRAY_A );
@ -384,4 +386,23 @@ class WC_API_Authentication {
break;
}
}
/**
* Updated API Key last access datetime
*
* @since 2.4.0
*
* @param int $key_id
*/
private function update_api_key_last_access( $key_id ) {
global $wpdb;
$wpdb->update(
$wpdb->prefix . 'woocommerce_api_keys',
array( 'last_access' => current_time( 'mysql' ) ),
array( 'key_id' => $key_id ),
array( '%s' ),
array( '%d' )
);
}
}

View File

@ -54,6 +54,8 @@ class WC_API_Authentication {
$user = $this->get_user_by_id( $keys['user_id'] );
$this->update_api_key_last_access( $keys['key_id'] );
} catch ( Exception $e ) {
$user = new WP_Error( 'woocommerce_api_authentication_error', $e->getMessage(), array( 'status' => $e->getCode() ) );
}
@ -172,7 +174,7 @@ class WC_API_Authentication {
$consumer_key = wc_api_hash( sanitize_text_field( $consumer_key ) );
$keys = $wpdb->get_row( $wpdb->prepare( "
SELECT *
SELECT key_id, user_id, permissions, consumer_key, consumer_secret, nonces
FROM {$wpdb->prefix}woocommerce_api_keys
WHERE consumer_key = '%s'
", $consumer_key ), ARRAY_A );
@ -384,4 +386,23 @@ class WC_API_Authentication {
break;
}
}
/**
* Updated API Key last access datetime
*
* @since 2.4.0
*
* @param int $key_id
*/
private function update_api_key_last_access( $key_id ) {
global $wpdb;
$wpdb->update(
$wpdb->prefix . 'woocommerce_api_keys',
array( 'last_access' => current_time( 'mysql' ) ),
array( 'key_id' => $key_id ),
array( '%s' ),
array( '%d' )
);
}
}

View File

@ -299,7 +299,6 @@ class WC_API_Customers extends WC_API_Resource {
* @since 2.2
* @param int $id the customer ID
* @param array $data
* @return void
*/
protected function update_customer_data( $id, $data ) {
// Customer first name.

View File

@ -1538,7 +1538,6 @@ class WC_API_Products extends WC_API_Resource {
* @since 2.2
* @param int $id
* @param array $data
* @return void
*/
private function save_product_shipping_data( $id, $data ) {
if ( isset( $data['weight'] ) ) {
@ -1588,7 +1587,6 @@ class WC_API_Products extends WC_API_Resource {
* @param int $product_id
* @param array $downloads
* @param int $variation_id
* @return void
*/
private function save_downloadable_files( $product_id, $downloads, $variation_id = 0 ) {
$files = array();

View File

@ -734,8 +734,11 @@ class WC_AJAX {
die(-1);
}
global $post;
$post_id = intval( $_POST['post_id'] );
$loop = intval( $_POST['loop'] );
$post = get_post( $post_id ); // Set $post global so its available like within the admin screens
$loop = intval( $_POST['loop'] );
$variation = array(
'post_title' => 'Product #' . $post_id . ' Variation',
@ -841,7 +844,9 @@ class WC_AJAX {
die(-1);
}
@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 );
}
$post_id = intval( $_POST['post_id'] );
@ -1889,8 +1894,6 @@ class WC_AJAX {
/**
* Search for downloadable product variations and return json
*
* @access public
* @return void
* @see WC_AJAX::json_search_products()
*/
public static function json_search_downloadable_products_and_variations() {
@ -2328,7 +2331,8 @@ class WC_AJAX {
'description' => $description,
'permissions' => $permissions,
'consumer_key' => wc_api_hash( $consumer_key ),
'consumer_secret' => $consumer_secret
'consumer_secret' => $consumer_secret,
'truncated_key' => substr( $consumer_key, -7 )
);
$wpdb->insert(
@ -2339,6 +2343,7 @@ class WC_AJAX {
'%s',
'%s',
'%s',
'%s',
'%s'
)
);
@ -2377,7 +2382,10 @@ class WC_AJAX {
die( -1 );
}
global $post;
$product_id = absint( $_POST['product_id'] );
$post = get_post( $product_id ); // Set $post global so its available like within the admin screens
$per_page = ! empty( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : 10;
$page = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
@ -2864,6 +2872,332 @@ class WC_AJAX {
wc_delete_product_transients( $product_id );
}
/**
* Bulk action - Toggle Enabled
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_toggle_enabled( $variations, $data ) {
global $wpdb;
foreach ( $variations as $variation_id ) {
$post_status = get_post_status( $variation_id );
$new_status = 'private' === $post_status ? 'publish' : 'private';
$wpdb->update( $wpdb->posts, array( 'post_status' => $new_status ), array( 'ID' => $variation_id ) );
}
}
/**
* Bulk action - Toggle Downloadable Checkbox
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_toggle_downloadable( $variations, $data ) {
foreach ( $variations as $variation_id ) {
$_downloadable = get_post_meta( $variation_id, '_downloadable', true );
$is_downloadable = 'no' === $_downloadable ? 'yes' : 'no';
update_post_meta( $variation_id, '_downloadable', wc_clean( $is_downloadable ) );
}
}
/**
* Bulk action - Toggle Virtual Checkbox
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_toggle_virtual( $variations, $data ) {
foreach ( $variations as $variation_id ) {
$_virtual = get_post_meta( $variation_id, '_virtual', true );
$is_virtual = 'no' === $_virtual ? 'yes' : 'no';
update_post_meta( $variation_id, '_virtual', wc_clean( $is_virtual ) );
}
}
/**
* Bulk action - Toggle Manage Stock Checkbox
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_toggle_manage_stock( $variations, $data ) {
foreach ( $variations as $variation_id ) {
$_manage_stock = get_post_meta( $variation_id, '_manage_stock', true );
$is_manage_stock = 'no' === $_manage_stock ? 'yes' : 'no';
update_post_meta( $variation_id, '_manage_stock', wc_clean( $is_manage_stock ) );
}
}
/**
* Bulk action - Set Regular Prices
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_regular_price( $variations, $data ) {
if ( empty( $data['value'] ) ) {
break;
}
foreach ( $variations as $variation_id ) {
// Price fields
$regular_price = wc_clean( $data['value'] );
$sale_price = get_post_meta( $variation_id, '_sale_price', true );
// Date fields
$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
$date_to = get_post_meta( $variation_id, '_sale_price_dates_to', true );
$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
$date_to = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
_wc_save_product_price( $variation_id, $regular_price, $sale_price, $date_from, $date_to );
}
}
/**
* Bulk action - Set Sale Prices
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_sale_price( $variations, $data ) {
if ( empty( $data['value'] ) ) {
break;
}
foreach ( $variations as $variation_id ) {
// Price fields
$regular_price = get_post_meta( $variation_id, '_regular_price', true );
$sale_price = wc_clean( $data['value'] );
// Date fields
$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
$date_to = get_post_meta( $variation_id, '_sale_price_dates_to', true );
$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
$date_to = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
_wc_save_product_price( $variation_id, $regular_price, $sale_price, $date_from, $date_to );
}
}
/**
* Bulk action - Set Stock
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_stock( $variations, $data ) {
if ( empty( $data['value'] ) ) {
break;
}
$value = wc_clean( $data['value'] );
if ( $value ) {
foreach ( $variations as $variation_id ) {
if ( 'yes' === get_post_meta( $variation_id, '_manage_stock', true ) ) {
wc_update_product_stock( $variation_id, wc_stock_amount( $value ) );
} else {
delete_post_meta( $variation_id, '_stock' );
}
}
}
}
/**
* Bulk action - Set Weight
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_weight( $variations, $data ) {
self::variation_bulk_set_meta( $variations, '_weight', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Set Length
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_length( $variations, $data ) {
self::variation_bulk_set_meta( $variations, '_length', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Set Width
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_width( $variations, $data ) {
self::variation_bulk_set_meta( $variations, '_width', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Set Height
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_height( $variations, $data ) {
self::variation_bulk_set_meta( $variations, '_height', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Set Download Limit
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_download_limit( $variations, $data ) {
self::variation_bulk_set_meta( $variations, '_download_limit', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Set Download Expiry
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_download_expiry( $variations, $data ) {
self::variation_bulk_set_meta( $variations, '_download_expiry', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Delete all
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_delete_all( $variations, $data ) {
if ( isset( $data['allowed'] ) && 'true' === $data['allowed'] ) {
foreach ( $variations as $variation_id ) {
wp_delete_post( $variation_id );
}
}
}
/**
* Bulk action - Sale Schedule
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_sale_schedule( $variations, $data ) {
if ( ! isset( $data['date_from'] ) && ! isset( $data['date_to'] ) ) {
break;
}
foreach ( $variations as $variation_id ) {
// Price fields
$regular_price = get_post_meta( $variation_id, '_regular_price', true );
$sale_price = get_post_meta( $variation_id, '_sale_price', true );
// Date fields
$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
$date_to = get_post_meta( $variation_id, '_sale_price_dates_to', true );
if ( 'false' === $data['date_from'] ) {
$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
} else {
$date_from = $data['date_from'];
}
if ( 'false' === $data['date_to'] ) {
$date_to = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
} else {
$date_to = $data['date_to'];
}
_wc_save_product_price( $variation_id, $regular_price, $sale_price, $date_from, $date_to );
}
}
/**
* Bulk action - Increase Regular Prices
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_regular_price_increase( $variations, $data ) {
self::variation_bulk_adjust_price( $variations, '_regular_price', '+', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Decrease Regular Prices
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_regular_price_decrease( $variations, $data ) {
self::variation_bulk_adjust_price( $variations, '_regular_price', '-', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Increase Sale Prices
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_sale_price_increase( $variations, $data ) {
self::variation_bulk_adjust_price( $variations, '_sale_price', '+', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Decrease Sale Prices
* @access private
* @param array $variations
* @param array $data
*/
private static function variation_bulk_action_variable_sale_price_decrease( $variations, $data ) {
self::variation_bulk_adjust_price( $variations, '_sale_price', '-', wc_clean( $data['value'] ) );
}
/**
* Bulk action - Set Price
* @access private
* @param array $variations
* @param string $operator + or -
* @param string $field price being adjusted
* @param string $value Price or Percent
*/
private static function variation_bulk_adjust_price( $variations, $field, $operator, $value ) {
foreach ( $variations as $variation_id ) {
// Get existing data
$_regular_price = get_post_meta( $variation_id, '_regular_price', true );
$_sale_price = get_post_meta( $variation_id, '_sale_price', true );
$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
$date_to = get_post_meta( $variation_id, '_sale_price_dates_to', true );
$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
$date_to = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
if ( '%' === substr( $value, -1 ) ) {
$percent = wc_format_decimal( substr( $value, 0, -1 ) );
$$field += ( ( $$field / 100 ) * $percent ) * "{$operator}1";
} else {
$$field += $value * "{$operator}1";
}
_wc_save_product_price( $variation_id, $_regular_price, $_sale_price, $date_from, $date_to );
}
}
/**
* Bulk action - Set Meta
* @access private
* @param array $variations
* @param string $field
* @param string $value
*/
private static function variation_bulk_set_meta( $variations, $field, $value ) {
foreach ( $variations as $variation_id ) {
update_post_meta( $variation_id, $field, $value );
}
}
/**
* Bulk edit variations via AJAX
*/
@ -2877,14 +3211,12 @@ class WC_AJAX {
die( -1 );
}
global $wpdb;
$product_id = absint( $_POST['product_id'] );
$bulk_action = wc_clean( $_POST['bulk_action'] );
$data = ! empty( $_POST['data'] ) ? array_map( 'wc_clean', $_POST['data'] ) : array();
$variations = array();
if ( apply_filters( 'woocommerce_bulk_edit_variations_need_children', ! in_array( $bulk_action, array( 'variable_weight', 'variable_length', 'variable_width', 'variable_height' ) ) ) ) {
if ( apply_filters( 'woocommerce_bulk_edit_variations_need_children', true ) ) {
$variations = get_posts( array(
'post_parent' => $product_id,
'posts_per_page' => -1,
@ -2894,194 +3226,10 @@ class WC_AJAX {
) );
}
switch ( $bulk_action ) {
case 'toggle_enabled' :
foreach ( $variations as $variation_id ) {
$post_status = get_post_status( $variation_id );
$new_status = 'private' === $post_status ? 'publish' : 'private';
$wpdb->update( $wpdb->posts, array( 'post_status' => $new_status ), array( 'ID' => $variation_id ) );
}
break;
case 'toggle_downloadable' :
foreach ( $variations as $variation_id ) {
$_downloadable = get_post_meta( $variation_id, '_downloadable', true );
$is_downloadable = 'no' === $_downloadable ? 'yes' : 'no';
update_post_meta( $variation_id, '_downloadable', wc_clean( $is_downloadable ) );
}
break;
case 'toggle_virtual' :
foreach ( $variations as $variation_id ) {
$_virtual = get_post_meta( $variation_id, '_virtual', true );
$is_virtual = 'no' === $_virtual ? 'yes' : 'no';
update_post_meta( $variation_id, '_virtual', wc_clean( $is_virtual ) );
}
break;
case 'toggle_manage_stock' :
foreach ( $variations as $variation_id ) {
$_manage_stock = get_post_meta( $variation_id, '_manage_stock', true );
$is_manage_stock = 'no' === $_manage_stock ? 'yes' : 'no';
update_post_meta( $variation_id, '_manage_stock', wc_clean( $is_manage_stock ) );
}
break;
case 'variable_regular_price' :
case 'variable_sale_price' :
if ( empty( $data['value'] ) ) {
break;
}
$field = str_replace( 'variable', '', $bulk_action );
foreach ( $variations as $variation_id ) {
// Price fields
$regular_price = '_regular_price' === $field ? $data['value'] : get_post_meta( $variation_id, '_regular_price', true );
$sale_price = '_sale_price' === $field ? $data['value'] : get_post_meta( $variation_id, '_sale_price', true );
// Date fields
$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
$date_to = get_post_meta( $variation_id, '_sale_price_dates_to', true );
$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
$date_to = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
_wc_save_product_price( $variation_id, $regular_price, $sale_price, $date_from, $date_to );
}
break;
case 'variable_stock' :
if ( empty( $data['value'] ) ) {
break;
}
$value = wc_clean( $data['value'] );
foreach ( $variations as $variation_id ) {
if ( 'yes' === get_post_meta( $variation_id, '_manage_stock', true ) ) {
wc_update_product_stock( $variation_id, wc_stock_amount( $value ) );
} else {
delete_post_meta( $variation_id, '_stock' );
}
}
break;
case 'variable_weight' :
case 'variable_length' :
case 'variable_width' :
case 'variable_height' :
if ( empty( $data['value'] ) ) {
break;
}
$value = wc_clean( $data['value'] );
$field = str_replace( 'variable', '', $bulk_action );
$wpdb->query( $wpdb->prepare( "
UPDATE $wpdb->postmeta AS postmeta
INNER JOIN $wpdb->posts AS posts ON posts.post_parent = %d
SET postmeta.meta_value = %s
WHERE postmeta.meta_key = '%s'
AND postmeta.post_id = posts.ID
", $product_id, $value, $field ) );
break;
case 'variable_download_limit' :
case 'variable_download_expiry' :
if ( empty( $data['value'] ) ) {
break;
}
$value = wc_clean( $data['value'] );
$field = str_replace( 'variable', '', $bulk_action );
foreach ( $variations as $variation_id ) {
if ( 'yes' === get_post_meta( $variation_id, '_downloadable', true ) ) {
update_post_meta( $variation_id, $field, $value );
} else {
update_post_meta( $variation_id, $field, '' );
}
}
break;
case 'delete_all' :
if ( isset( $data['allowed'] ) && 'true' === $data['allowed'] ) {
foreach ( $variations as $variation_id ) {
wp_delete_post( $variation_id );
}
}
break;
case 'variable_regular_price_increase' :
case 'variable_regular_price_decrease' :
case 'variable_sale_price_increase' :
case 'variable_sale_price_decrease' :
if ( empty( $data['value'] ) ) {
break;
}
$field = str_replace( array( 'variable', '_increase', '_decrease' ), '', $bulk_action );
$operator = 'increase' === substr( $bulk_action, -8 ) ? +1 : -1;
foreach ( $variations as $variation_id ) {
// Price fields
$regular_price = get_post_meta( $variation_id, '_regular_price', true );
$sale_price = get_post_meta( $variation_id, '_sale_price', true );
// Date fields
$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
$date_to = get_post_meta( $variation_id, '_sale_price_dates_to', true );
$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
$date_to = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
if ( '%' === substr( $data['value'], -1 ) ) {
$percent = wc_format_decimal( substr( $data['value'], 0, -1 ) );
if ( '_regular_price' === $field ) {
$regular_price += ( ( $regular_price / 100 ) * $percent ) * $operator;
} else {
$sale_price += ( ( $sale_price / 100 ) * $percent ) * $operator;
}
} else {
if ( '_regular_price' === $field ) {
$regular_price += $data['value'];
} else {
$sale_price += $data['value'];
}
}
_wc_save_product_price( $variation_id, $regular_price, $sale_price, $date_from, $date_to );
}
break;
case 'variable_sale_schedule' :
if ( ! isset( $data['date_from'] ) && ! isset( $data['date_to'] ) ) {
break;
}
foreach ( $variations as $variation_id ) {
// Price fields
$regular_price = get_post_meta( $variation_id, '_regular_price', true );
$sale_price = get_post_meta( $variation_id, '_sale_price', true );
// Date fields
$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
$date_to = get_post_meta( $variation_id, '_sale_price_dates_to', true );
if ( 'false' === $data['date_from'] ) {
$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
} else {
$date_from = $data['date_from'];
}
if ( 'false' === $data['date_to'] ) {
$date_to = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
} else {
$date_to = $data['date_to'];
}
_wc_save_product_price( $variation_id, $regular_price, $sale_price, $date_from, $date_to );
}
break;
default :
do_action( 'woocommerce_bulk_edit_variations_default', $bulk_action, $data, $product_id, $variations );
break;
if ( method_exists( __CLASS__, "variation_bulk_action_$bulk_action" ) ) {
call_user_func( array( __CLASS__, "variation_bulk_action_$bulk_action" ), $variations, $data );
} else {
do_action( 'woocommerce_bulk_edit_variations_default', $bulk_action, $data, $product_id, $variations );
}
do_action( 'woocommerce_bulk_edit_variations', $bulk_action, $data, $product_id, $variations );
@ -3089,7 +3237,6 @@ class WC_AJAX {
// Sync and update transients
WC_Product_Variable::sync( $product_id );
wc_delete_product_transients( $product_id );
die();
}
}

View File

@ -204,7 +204,8 @@ class WC_Auth {
'description' => $description,
'permissions' => $permissions,
'consumer_key' => wc_api_hash( $consumer_key ),
'consumer_secret' => $consumer_secret
'consumer_secret' => $consumer_secret,
'truncated_key' => substr( $consumer_key, -7 )
),
array(
'%d',
@ -279,7 +280,7 @@ class WC_Auth {
/**
* Auth endpoint
*
* @since 2.4.0
* @since 2.4.0
*
* @param string $route
*/

View File

@ -22,6 +22,7 @@ class WC_Cache_Helper {
add_action( 'template_redirect', array( __CLASS__, 'geolocation_ajax_redirect' ) );
add_action( 'before_woocommerce_init', array( __CLASS__, 'prevent_caching' ) );
add_action( 'admin_notices', array( __CLASS__, 'notices' ) );
add_action( 'delete_version_transients', array( __CLASS__, 'delete_version_transients' ) );
}
/**
@ -102,10 +103,17 @@ class WC_Cache_Helper {
*
* @since 2.3.10
*/
private static function delete_version_transients( $version ) {
public static function delete_version_transients( $version = '' ) {
if ( ! wp_using_ext_object_cache() && ! empty( $version ) ) {
global $wpdb;
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s;", "\_transient\_%" . $version ) );
$limit = 1000;
$affected = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s ORDER BY option_id LIMIT %d;", "\_transient\_%" . $version, $limit ) );
// If affected rows is equal to limit, there are more rows to delete. Delete in 10 secs.
if ( $affected === $limit ) {
wp_schedule_single_event( time() + 10, 'delete_version_transients', array( $version ) );
}
}
}

View File

@ -634,7 +634,7 @@ class WC_Cart {
* @return string url to page
*/
public function get_checkout_url() {
$checkout_url = wc_get_page_permalink( 'checkout' );
$checkout_url = wc_get_page_permalink( 'checkout' );
if ( $checkout_url ) {
// Force SSL if needed
if ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) {
@ -651,8 +651,8 @@ class WC_Cart {
* @return string url to page
*/
public function get_remove_url( $cart_item_key ) {
$cart_page_id = wc_get_page_id('cart');
return apply_filters( 'woocommerce_get_remove_url', $cart_page_id ? wp_nonce_url( add_query_arg( 'remove_item', $cart_item_key, get_permalink( $cart_page_id ) ), 'woocommerce-cart' ) : '' );
$cart_page_url = wc_get_page_permalink( 'cart' );
return apply_filters( 'woocommerce_get_remove_url', $cart_page_url ? wp_nonce_url( add_query_arg( 'remove_item', $cart_item_key, $cart_page_url ), 'woocommerce-cart' ) : '' );
}
/**
@ -662,13 +662,13 @@ class WC_Cart {
* @return string url to page
*/
public function get_undo_url( $cart_item_key ) {
$cart_page_id = wc_get_page_id( 'cart' );
$cart_page_url = wc_get_page_permalink( 'cart' );
$query_args = array(
'undo_item' => $cart_item_key,
);
return apply_filters( 'woocommerce_get_undo_url', $cart_page_id ? wp_nonce_url( add_query_arg( $query_args, get_permalink( $cart_page_id ) ), 'woocommerce-cart' ) : '' );
return apply_filters( 'woocommerce_get_undo_url', $cart_page_url ? wp_nonce_url( add_query_arg( $query_args, $cart_page_url ), 'woocommerce-cart' ) : '' );
}
/**

View File

@ -137,9 +137,6 @@ class WC_Checkout {
/**
* Output the billing information form
*
* @access public
* @return void
*/
public function checkout_form_billing() {
wc_get_template( 'checkout/form-billing.php', array( 'checkout' => $this ) );
@ -147,9 +144,6 @@ class WC_Checkout {
/**
* Output the shipping information form
*
* @access public
* @return void
*/
public function checkout_form_shipping() {
wc_get_template( 'checkout/form-shipping.php', array( 'checkout' => $this ) );
@ -343,9 +337,6 @@ class WC_Checkout {
/**
* Process the checkout after the confirm order button is pressed
*
* @access public
* @return void
*/
public function process_checkout() {
try {

View File

@ -55,6 +55,7 @@ class WC_Countries {
$states = array(
'AF' => array(),
'AT' => array(),
'AX' => array(),
'BE' => array(),
'BI' => array(),
'CZ' => array(),
@ -308,10 +309,9 @@ class WC_Countries {
/**
* Outputs the list of countries and states for use in dropdown boxes.
* @param string $selected_country (default: '')
* @param string $selected_state (default: '')
* @param bool $escape (default: false)
* @return void
* @param string $selected_country (default: '')
* @param string $selected_state (default: '')
* @param bool $escape (default: false)
*/
public function country_dropdown_options( $selected_country = '', $selected_state = '', $escape = false ) {
if ( $this->countries ) foreach ( $this->countries as $key => $value ) :
@ -320,14 +320,18 @@ class WC_Countries {
foreach ( $states as $state_key => $state_value ) :
echo '<option value="' . esc_attr( $key ) . ':' . $state_key . '"';
if ( $selected_country == $key && $selected_state == $state_key ) echo ' selected="selected"';
if ( $selected_country == $key && $selected_state == $state_key ) {
echo ' selected="selected"';
}
echo '>' . $value . ' &mdash; ' . ( $escape ? esc_js( $state_value ) : $state_value ) . '</option>';
endforeach;
echo '</optgroup>';
else :
echo '<option';
if ( $selected_country == $key && $selected_state == '*' ) echo ' selected="selected"';
if ( $selected_country == $key && $selected_state == '*' ) {
echo ' selected="selected"';
}
echo ' value="' . esc_attr( $key ) . '">' . ( $escape ? esc_js( $value ) : $value ) . '</option>';
endif;
endforeach;
@ -593,6 +597,12 @@ class WC_Countries {
//'placeholder' => __( 'State', 'woocommerce' ),
)
),
'AX' => array(
'postcode_before_city' => true,
'state' => array(
'required' => false,
),
),
'BD' => array(
'postcode' => array(
'required' => false

View File

@ -247,9 +247,7 @@ class WC_Coupon {
/**
* Increase usage count for current coupon.
*
* @access public
* @param string $used_by Either user ID or billing email
* @return void
* @param string $used_by Either user ID or billing email
*/
public function inc_usage_count( $used_by = '' ) {
if ( $this->id ) {
@ -265,9 +263,7 @@ class WC_Coupon {
/**
* Decrease usage count for current coupon.
*
* @access public
* @param string $used_by Either user ID or billing email
* @return void
* @param string $used_by Either user ID or billing email
*/
public function dcr_usage_count( $used_by = '' ) {
if ( $this->id ) {
@ -401,10 +397,14 @@ class WC_Coupon {
if ( 'yes' === $this->exclude_sale_items && $this->is_type( array( 'fixed_product', 'percent_product' ) ) ) {
$valid_for_cart = false;
$product_ids_on_sale = wc_get_product_ids_on_sale();
if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( sizeof( array_intersect( array( absint( $cart_item['product_id'] ), absint( $cart_item['variation_id'] ), $cart_item['data']->get_parent() ), $product_ids_on_sale ) ) === 0 ) {
// not on sale
if ( ! empty( $cart_item['variation_id'] ) ) {
if ( ! in_array( $cart_item['variation_id'], $product_ids_on_sale, true ) ) {
$valid_for_cart = true;
}
} elseif ( ! in_array( $cart_item['product_id'], $product_ids_on_sale, true ) ) {
$valid_for_cart = true;
}
}

View File

@ -338,11 +338,11 @@ class WC_Download_Handler {
* Check and set certain server config variables to ensure downloads work as intended.
*/
private static function check_server_config() {
if ( ! ini_get('safe_mode') ) {
@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 );
}
if ( function_exists( 'get_magic_quotes_runtime' ) && get_magic_quotes_runtime() ) {
@set_magic_quotes_runtime(0);
if ( function_exists( 'get_magic_quotes_runtime' ) && get_magic_quotes_runtime() && version_compare( phpversion(), '5.4', '<' ) ) {
set_magic_quotes_runtime( 0 );
}
if ( function_exists( 'apache_setenv' ) ) {
@apache_setenv( 'no-gzip', 1 );

View File

@ -213,11 +213,12 @@ class WC_Emails {
* @param mixed $message
* @param string $headers (default: "Content-Type: text/html\r\n")
* @param string $attachments (default: "")
* @return bool
*/
public function send( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) {
// Send
$email = new WC_Email();
$email->send( $to, $subject, $message, $headers, $attachments );
return $email->send( $to, $subject, $message, $headers, $attachments );
}
/**
@ -366,8 +367,6 @@ class WC_Emails {
/**
* Get the email addresses.
*
* @return void
*/
public function email_addresses( $order, $sent_to_admin = false, $plain_text = false ) {
if ( $plain_text ) {

View File

@ -7,7 +7,7 @@
* @author WooThemes
* @category Admin
* @package WooCommerce/Classes
* @version 2.3.1
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -1104,6 +1104,12 @@ class WC_Geo_IP {
'--'
);
/**
* Open geoip file
*
* @param string $filename
* @param int $flags
*/
public function geoip_open( $filename, $flags ) {
$this->flags = $flags;
if ( $this->flags & self::GEOIP_SHARED_MEMORY ) {
@ -1119,6 +1125,11 @@ class WC_Geo_IP {
$this->_setup_segments();
}
/**
* Setup segments
*
* @return WC_Geo_IP instance
*/
private function _setup_segments() {
$this->databaseType = self::GEOIP_COUNTRY_EDITION;
$this->record_length = self::STANDARD_RECORD_LENGTH;
@ -1269,6 +1280,11 @@ class WC_Geo_IP {
return $this;
}
/**
* Close geoip file
*
* @return bool
*/
public function geoip_close() {
if ( $this->flags & self::GEOIP_SHARED_MEMORY ) {
return true;
@ -1277,6 +1293,12 @@ class WC_Geo_IP {
return fclose( $this->filehandle );
}
/**
* Common get record
*
* @param string $seek_country
* @return WC_Geo_IP_Record instance
*/
private function _common_get_record( $seek_country ) {
// workaround php's broken substr, strpos, etc handling with
// mbstring.func_overload and mbstring.internal_encoding
@ -1386,6 +1408,12 @@ class WC_Geo_IP {
return $record;
}
/**
* Get record
*
* @param int $ipnum
* @return WC_Geo_IP_Record instance
*/
private function _get_record( $ipnum ) {
$seek_country = $this->_geoip_seek_country( $ipnum );
if ( $seek_country == $this->databaseSegments ) {
@ -1395,6 +1423,12 @@ class WC_Geo_IP {
return $this->_common_get_record( $seek_country );
}
/**
* Seek country IPv6
*
* @param int $ipnum [description]
* @return bool|int
*/
function _geoip_seek_country_v6( $ipnum ) {
// arrays from unpack start with offset 1
// yet another php mystery. array_merge work around
@ -1449,6 +1483,12 @@ class WC_Geo_IP {
return false;
}
/**
* Seek country
*
* @param int $ipnum
* @return bool|int
*/
private function _geoip_seek_country( $ipnum ) {
$offset = 0;
for ( $depth = 31; $depth >= 0; --$depth ) {
@ -1497,6 +1537,12 @@ class WC_Geo_IP {
return false;
}
/**
* Record by addr
*
* @param string $addr
* @return int
*/
public function geoip_record_by_addr( $addr ) {
if ( $addr == null ) {
return 0;
@ -1506,16 +1552,34 @@ class WC_Geo_IP {
return $this->_get_record( $ipnum );
}
/**
* Country ID by addr IPv6
*
* @param string $addr
* @return int
*/
public function geoip_country_id_by_addr_v6( $addr ) {
$ipnum = inet_pton( $addr );
return $this->_geoip_seek_country_v6( $ipnum ) - self::GEOIP_COUNTRY_BEGIN;
}
/**
* Country ID by addr
*
* @param string $addr
* @return int
*/
public function geoip_country_id_by_addr( $addr ) {
$ipnum = ip2long( $addr );
return $this->_geoip_seek_country( $ipnum ) - self::GEOIP_COUNTRY_BEGIN;
}
/**
* Country code by addr IPv6
*
* @param string $addr
* @return bool|int
*/
public function geoip_country_code_by_addr_v6( $addr ) {
$country_id = $this->geoip_country_id_by_addr_v6( $addr );
if ( $country_id !== false ) {
@ -1525,6 +1589,12 @@ class WC_Geo_IP {
return false;
}
/**
* Country code by addr
*
* @param string $addr
* @return bool|int
*/
public function geoip_country_code_by_addr( $addr ) {
if ( $this->databaseType == self::GEOIP_CITY_EDITION_REV1 ) {
$record = $this->geoip_record_by_addr( $addr);
@ -1541,6 +1611,15 @@ class WC_Geo_IP {
return false;
}
/**
* Encode string
*
* @param string $string
* @param int $start
* @param int $length
*
* @return string
*/
private function _safe_substr( $string, $start, $length ) {
// workaround php's broken substr, strpos, etc handling with
// mbstring.func_overload and mbstring.internal_encoding
@ -1561,6 +1640,9 @@ class WC_Geo_IP {
}
}
/**
* Geo IP Record class
*/
class WC_Geo_IP_Record {
public $country_code;
public $country_code3;
@ -1571,7 +1653,7 @@ class WC_Geo_IP_Record {
public $latitude;
public $longitude;
public $area_code;
public $dma_code; # metro and dma code are the same. use metro_code
public $dma_code; // metro and dma code are the same. use metro_code
public $metro_code;
public $continent_code;
}

View File

@ -185,7 +185,7 @@ class WC_Geolocation {
$handle = @fopen( self::get_local_database_path( $tmp_database_version ), 'w' );
if ( $gzhandle && $handle ) {
while ( ( $string = gzread( $gzhandle, 4096 ) ) != false ) {
while ( $string = gzread( $gzhandle, 4096 ) ) {
fwrite( $handle, $string, strlen( $string ) );
}
gzclose( $gzhandle );

View File

@ -302,8 +302,6 @@ class WC_Install {
* woocommerce_order_itemmeta - Order line item meta is stored in a table for storing extra data.
* woocommerce_tax_rates - Tax Rates are stored inside 2 tables making tax queries simple and efficient.
* woocommerce_tax_rate_locations - Each rate can be applied to more than one postcode/city hence the second table.
*
* @return void
*/
private static function create_tables() {
global $wpdb;
@ -357,6 +355,8 @@ CREATE TABLE {$wpdb->prefix}woocommerce_api_keys (
consumer_key char(64) NOT NULL,
consumer_secret char(43) NOT NULL,
nonces longtext NULL,
truncated_key char(7) NOT NULL,
last_access datetime NULL default null,
PRIMARY KEY (key_id),
KEY consumer_key (consumer_key),
KEY consumer_secret (consumer_secret)

View File

@ -4,11 +4,11 @@
*
* Loads Integrations into WooCommerce.
*
* @class WC_Integrations
* @version 2.3.0
* @package WooCommerce/Classes/Integrations
* @category Class
* @author WooThemes
* @class WC_Integrations
* @version 2.3.0
* @package WooCommerce/Classes/Integrations
* @category Class
* @author WooThemes
*/
class WC_Integrations {
@ -16,10 +16,7 @@ class WC_Integrations {
public $integrations = array();
/**
* __construct function.
*
* @access public
* @return void
* Initialize integrations.
*/
public function __construct() {
@ -34,7 +31,6 @@ class WC_Integrations {
$this->integrations[ $load_integration->id ] = $load_integration;
}
}
/**

View File

@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* Downloads the last language pack.
*
* @class WC_Language_Pack_Upgrader
* @version 2.2.0
* @version 2.4.0
* @package WooCommerce/Classes/Language
* @category Class
* @author WooThemes
@ -56,13 +56,15 @@ class WC_Language_Pack_Upgrader {
*/
public function check_for_update( $data ) {
if ( $this->has_available_update() ) {
$locale = get_locale();
$data->translations[] = array(
'type' => 'plugin',
'slug' => 'woocommerce',
'language' => get_locale(),
'language' => $locale,
'version' => WC_VERSION,
'updated' => date( 'Y-m-d H:i:s' ),
'package' => $this->get_language_package_uri(),
'package' => $this->get_language_package_uri( $locale ),
'autoupdate' => 1
);
}
@ -72,8 +74,9 @@ class WC_Language_Pack_Upgrader {
/**
* Triggered when WPLANG is changed
* @param string $old
* @param string $new
*
* @param string $old
* @param string $new
*/
public function updated_language_option( $old, $new ) {
$this->has_available_update( $new );
@ -110,8 +113,6 @@ class WC_Language_Pack_Upgrader {
/**
* Configure the WooCommerce translation upgrade notice
*
* @return void
*/
public function configure_woocommerce_upgrade_notice() {
WC_Admin_Notices::add_notice( 'translation_upgrade' );
@ -122,8 +123,8 @@ class WC_Language_Pack_Upgrader {
*
* @return bool
*/
public function check_if_language_pack_exists() {
$response = wp_safe_remote_get( $this->get_language_package_uri(), array( 'timeout' => 60 ) );
public function check_if_language_pack_exists( $locale ) {
$response = wp_safe_remote_get( $this->get_language_package_uri( $locale ), array( 'timeout' => 60 ) );
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
return true;
@ -153,8 +154,6 @@ class WC_Language_Pack_Upgrader {
/**
* Save language version
*
* @return void
*/
protected function save_language_version() {
// Update the language pack version
@ -168,8 +167,6 @@ class WC_Language_Pack_Upgrader {
/**
* Manual language update
*
* @return void
*/
public function manual_language_update() {
if (

View File

@ -18,9 +18,6 @@ class WC_Logger {
/**
* Constructor for the logger.
*
* @access public
* @return void
*/
public function __construct() {
$this->_handles = array();
@ -29,9 +26,6 @@ class WC_Logger {
/**
* Destructor.
*
* @access public
* @return void
*/
public function __destruct() {
foreach ( $this->_handles as $handle ) {
@ -63,17 +57,15 @@ class WC_Logger {
/**
* Add a log entry to chosen file.
*
* @access public
* @param string $handle
* @param string $message
* @return void
*/
public function add( $handle, $message ) {
if ( $this->open( $handle ) && is_resource( $this->_handles[ $handle ] ) ) {
$time = date_i18n( 'm-d-Y @ H:i:s -' ); // Grab Time
@fwrite( $this->_handles[ $handle ], $time . " " . $message . "\n" );
}
do_action( 'woocommerce_log_add', $handle, $message );
}
@ -81,15 +73,13 @@ class WC_Logger {
/**
* Clear entries from chosen file.
*
* @access public
* @param mixed $handle
* @return void
*/
public function clear( $handle ) {
if ( $this->open( $handle ) && is_resource( $this->_handles[ $handle ] ) ) {
@ftruncate( $this->_handles[ $handle ], 0 );
}
do_action( 'woocommerce_log_clear', $handle );
}

View File

@ -26,7 +26,7 @@ class WC_Order_Item_Meta {
/**
* Constructor
*
* @param array $item_meta defaults to array()
* @param array $item defaults to array()
* @param \WC_Product $product defaults to null
* @return \WC_Order_Item_Meta instance
*/
@ -139,7 +139,7 @@ class WC_Order_Item_Meta {
* Handles @deprecated args
* @return array
*/
public function get_formatted_legacy() {
public function get_formatted_legacy( $hideprefix = '_' ) {
_deprecated_function( 'get_formatted_legacy', '2.4', 'Item Meta Data is being called with legacy arguments' );
$formatted_meta = array();

View File

@ -65,9 +65,7 @@ class WC_Order_Refund extends WC_Abstract_Order {
/**
* Populates an refund from the loaded post data
*
* @since 2.2
* @param mixed $result
* @return void
*/
public function populate( $result ) {
// Standard post data
@ -96,7 +94,7 @@ class WC_Order_Refund extends WC_Abstract_Order {
public function get_formatted_refund_amount() {
return apply_filters( 'woocommerce_formatted_refund_amount', wc_price( $this->refund_amount, array('currency' => $this->get_order_currency()) ), $this );
}
/**
* Get refunded amount

View File

@ -10,6 +10,46 @@
*/
class WC_Order extends WC_Abstract_Order {
/** @public string Order type */
public $order_type = 'simple';
/**
* Gets order total - formatted for display.
*
* @return string
*/
public function get_formatted_order_total( $tax_display = '' ) {
$formatted_total = wc_price( $this->get_total(), array( 'currency' => $this->get_order_currency() ) );
$order_total = $this->get_total();
$total_refunded = $this->get_total_refunded();
$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 ) {
$formatted_total = '<del>' . strip_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_order_currency() ) ) . $tax_string . '</ins>';
} else {
$formatted_total .= $tax_string;
}
return apply_filters( 'woocommerce_get_formatted_order_total', $formatted_total, $this );
}
/**
* Get order refunds
*

View File

@ -56,10 +56,7 @@ class WC_Payment_Gateways {
}
/**
* __construct function.
*
* @access public
* @return void
* Initialize payment gateways.
*/
public function __construct() {
$this->init();
@ -67,9 +64,6 @@ class WC_Payment_Gateways {
/**
* Load gateways and hook in functions.
*
* @access public
* @return void
*/
public function init() {
$load_gateways = array(
@ -167,9 +161,6 @@ class WC_Payment_Gateways {
/**
* Save options in admin.
*
* @access public
* @return void
*/
public function process_admin_options() {

View File

@ -18,9 +18,8 @@ if ( ! defined( 'ABSPATH' ) ) {
class WC_Product_Simple extends WC_Product {
/**
* __construct function.
* Initialize simple product.
*
* @access public
* @param mixed $product
*/
public function __construct( $product ) {
@ -31,7 +30,6 @@ class WC_Product_Simple extends WC_Product {
/**
* Get the add to url used mainly in loops.
*
* @access public
* @return string
*/
public function add_to_cart_url() {
@ -43,7 +41,6 @@ class WC_Product_Simple extends WC_Product {
/**
* Get the add to cart button text
*
* @access public
* @return string
*/
public function add_to_cart_text() {
@ -55,7 +52,6 @@ class WC_Product_Simple extends WC_Product {
/**
* Get the title of the post.
*
* @access public
* @return string
*/
public function get_title() {
@ -71,9 +67,6 @@ class WC_Product_Simple extends WC_Product {
/**
* Sync grouped products with the children lowest price (so they can be sorted by price accurately).
*
* @access public
* @return void
*/
public function grouped_product_sync() {
if ( ! $this->get_parent() ) return;

View File

@ -110,10 +110,7 @@ class WC_Product_Variable extends WC_Product {
}
/**
* set_stock_status function.
*
* @access public
* @return void
* Set stock status.
*/
public function set_stock_status( $status ) {
$status = 'outofstock' === $status ? 'outofstock' : 'instock';
@ -490,7 +487,7 @@ class WC_Product_Variable extends WC_Product {
/**
* Returns an array of date for a variation. Used in the add to cart form.
* @since 2.4.0
* @param $variation Variation product object or ID
* @param WC_Product|int $variation Variation product object or ID
* @return array
*/
public function get_available_variation( $variation ) {

View File

@ -409,6 +409,15 @@ class WC_Product_Variation extends WC_Product {
return true === $this->managing_stock() ? wc_stock_amount( $this->stock ) : $this->parent->get_stock_quantity();
}
/**
* Returns the tax status. Always use parent data.
*
* @return string
*/
public function get_tax_status() {
return $this->parent->get_tax_status();
}
/**
* Returns whether or not the product is in stock.
*

View File

@ -203,9 +203,7 @@ class WC_Query {
/**
* Hook into pre_get_posts to do the main product query
*
* @access public
* @param mixed $q query object
* @return void
*/
public function pre_get_posts( $q ) {
// We only want to affect the main query
@ -410,9 +408,7 @@ class WC_Query {
/**
* Query the products, applying sorting/ordering etc. This applies to the main wordpress loop
*
* @access public
* @param mixed $q
* @return void
*/
public function product_query( $q ) {
@ -450,9 +446,6 @@ class WC_Query {
/**
* Remove the query
*
* @access public
* @return void
*/
public function remove_product_query() {
remove_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
@ -468,9 +461,6 @@ class WC_Query {
/**
* Remove the posts_where filter
*
* @access public
* @return void
*/
public function remove_posts_where() {
remove_filter( 'posts_where', array( $this, 'search_post_excerpt' ) );
@ -479,9 +469,6 @@ class WC_Query {
/**
* Get an unpaginated list all product ID's (both filtered and unfiltered). Makes use of transients.
*
* @access public
* @return void
*/
public function get_products_in_view() {
global $wp_the_query;

View File

@ -75,10 +75,7 @@ class WC_Shipping {
}
/**
* __construct function.
*
* @access public
* @return void
* Initialize shipping.
*/
public function __construct() {
$this->init();
@ -86,8 +83,6 @@ class WC_Shipping {
/**
* init function.
*
* @access public
*/
public function init() {
do_action( 'woocommerce_shipping_init' );
@ -134,9 +129,7 @@ class WC_Shipping {
/**
* Register a shipping method for use in calculations.
*
* @access public
* @param object|string $method Either the name of the method's class, or an instance of the method's class
* @return void
* @param object|string $method Either the name of the method's class, or an instance of the method's class
*/
public function register_shipping_method( $method ) {
if ( ! is_object( $method ) ) {
@ -149,21 +142,17 @@ class WC_Shipping {
}
/**
* unregister_shipping_methods function.
*
* @access public
* @return void
* Unregister shipping methods.
*/
public function unregister_shipping_methods() {
unset( $this->shipping_methods );
}
/**
* sort_shipping_methods function.
* Sort shipping methods.
*
* Sorts shipping methods into the user defined order.
*
* @access public
* @return array
*/
public function sort_shipping_methods() {
@ -298,9 +287,6 @@ class WC_Shipping {
// Get chosen methods for each package
foreach ( $this->packages as $i => $package ) {
$_cheapest_cost = false;
$_cheapest_method = false;
$chosen_method = false;
$method_count = false;
@ -401,6 +387,7 @@ class WC_Shipping {
/**
* Get packages
*
* @return array
*/
public function get_packages() {
@ -408,12 +395,9 @@ class WC_Shipping {
}
/**
* reset_shipping function.
* Reset shipping.
*
* Reset the totals for shipping as a whole.
*
* @access public
* @return void
*/
public function reset_shipping() {
unset( WC()->session->chosen_shipping_methods );
@ -423,7 +407,7 @@ class WC_Shipping {
}
/**
* process_admin_options function.
* Process admin options.
*
* Saves options on the shipping setting page.
*/

View File

@ -47,7 +47,7 @@ class WC_Shortcodes {
/**
* Shortcode Wrapper
*
* @param mixed $function
* @param string[] $function
* @param array $atts (default: array())
* @return string
*/

View File

@ -33,8 +33,8 @@ class WC_Tracker {
/**
* Decide whether to send tracking data or not
* @param boolean $override
* @return void
*
* @param boolean $override
*/
public static function send_tracking_data( $override = false ) {
// Dont trigger this on AJAX Requests

View File

@ -562,6 +562,7 @@ class WC_Webhook {
'woocommerce_process_shop_order_meta',
'woocommerce_api_edit_order',
'woocommerce_order_edit_status',
'woocommerce_order_status_changed'
),
'order.deleted' => array(
'wp_trash_post',

View File

@ -49,10 +49,7 @@ class WC_Email_Cancelled_Order extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $order_id ) {
@ -89,9 +86,8 @@ class WC_Email_Cancelled_Order extends WC_Email {
}
/**
* get_content_plain function.
* Get content plain.
*
* @access public
* @return string
*/
function get_content_plain() {
@ -106,10 +102,7 @@ class WC_Email_Cancelled_Order extends WC_Email {
}
/**
* Initialise Settings Form Fields
*
* @access public
* @return void
* Initialise settings form fields.
*/
function init_form_fields() {
$this->form_fields = array(

View File

@ -46,10 +46,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $order_id ) {
@ -117,9 +114,8 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
}
/**
* get_content_plain function.
* Get content plain.
*
* @access public
* @return string
*/
function get_content_plain() {
@ -134,10 +130,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
}
/**
* Initialise Settings Form Fields
*
* @access public
* @return void
* Initialise settings form fields.
*/
function init_form_fields() {
$this->form_fields = array(

View File

@ -48,10 +48,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $order ) {
@ -140,10 +137,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
}
/**
* Initialise Settings Form Fields
*
* @access public
* @return void
* Initialise settings form fields
*/
function init_form_fields() {
$this->form_fields = array(

View File

@ -25,9 +25,6 @@ class WC_Email_Customer_New_Account extends WC_Email {
/**
* Constructor
*
* @access public
* @return void
*/
function __construct() {
@ -46,10 +43,7 @@ class WC_Email_Customer_New_Account extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $user_id, $user_pass = '', $password_generated = false ) {

View File

@ -23,9 +23,6 @@ class WC_Email_Customer_Note extends WC_Email {
/**
* Constructor
*
* @access public
* @return void
*/
function __construct() {
@ -47,10 +44,7 @@ class WC_Email_Customer_Note extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $args ) {

View File

@ -43,10 +43,7 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $order_id ) {

View File

@ -65,10 +65,7 @@ class WC_Email_Customer_Refunded_Order extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $order_id, $partial_refund = false, $refund_id = null ) {
@ -145,9 +142,8 @@ class WC_Email_Customer_Refunded_Order extends WC_Email {
}
/**
* get_content_plain function.
* Get content plain.
*
* @access public
* @return string
*/
function get_content_plain() {
@ -164,10 +160,7 @@ class WC_Email_Customer_Refunded_Order extends WC_Email {
}
/**
* Initialise Settings Form Fields
*
* @access public
* @return void
* Initialise settings form fields.
*/
function init_form_fields() {
$this->form_fields = array(

View File

@ -30,9 +30,6 @@ class WC_Email_Customer_Reset_Password extends WC_Email {
/**
* Constructor
*
* @access public
* @return void
*/
function __construct() {
@ -54,10 +51,7 @@ class WC_Email_Customer_Reset_Password extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $user_login = '', $reset_key = '' ) {
if ( $user_login && $reset_key ) {

View File

@ -53,10 +53,7 @@ class WC_Email_New_Order extends WC_Email {
}
/**
* trigger function.
*
* @access public
* @return void
* Trigger.
*/
function trigger( $order_id ) {
@ -112,10 +109,7 @@ class WC_Email_New_Order extends WC_Email {
}
/**
* Initialise Settings Form Fields
*
* @access public
* @return void
* Initialise settings form fields
*/
function init_form_fields() {
$this->form_fields = array(

View File

@ -237,11 +237,9 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
/**
* Add content to the WC emails.
*
* @access public
* @param WC_Order $order
* @param bool $sent_to_admin
* @param bool $plain_text
* @return void
*/
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
@ -406,4 +404,4 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
return $this->locale;
}
}
}

View File

@ -335,7 +335,6 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
* @param float $amount_to_charge The amount to charge.
* @param WC_Order $order The WC_Order object of the order which the subscription was purchased in.
* @param int $product_id The ID of the subscription product for which this payment relates.
* @return void
*/
public function scheduled_subscription_payment( $amount_to_charge, $order, $product_id ) {
$result = $this->process_subscription_payment( $order, $amount_to_charge );
@ -371,7 +370,6 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
* @param WC_Order $original_order The original order in which the subscription was purchased.
* @param WC_Order $renewal_order The order which recorded the successful payment (to make up for the failed automatic payment).
* @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key()
* @return void
*/
public function update_failing_payment_method( $original_order, $renewal_order, $subscription_key ) {
$new_customer_id = get_post_meta( $renewal_order->id, '_simplify_customer_id', true );

View File

@ -67,8 +67,6 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
/**
* Init Simplify SDK.
*
* @return void
*/
protected function init_simplify_sdk() {
// Include lib
@ -82,9 +80,6 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
/**
* Admin Panel Options
* - Options for bits like 'title' and availability on a country-by-country basis
*
* @access public
* @return void
*/
public function admin_options() {
?>

View File

@ -137,8 +137,6 @@ class Emogrifier {
* Sets the HTML to emogrify.
*
* @param string $html the HTML to emogrify, must be UTF-8-encoded
*
* @return void
*/
public function setHtml($html = '') {
$this->html = $html;
@ -148,8 +146,6 @@ class Emogrifier {
* Sets the CSS to merge with the HTML.
*
* @param string $css the CSS to merge, must be UTF-8-encoded
*
* @return void
*/
public function setCss($css = '') {
$this->css = $css;
@ -157,8 +153,6 @@ class Emogrifier {
/**
* Clears all caches.
*
* @return void
*/
private function clearAllCaches() {
$this->clearCache(self::CACHE_KEY_CSS);
@ -172,8 +166,6 @@ class Emogrifier {
*
* @param integer $key the cache key, must be CACHE_KEY_CSS, CACHE_KEY_SELECTOR, CACHE_KEY_XPATH or CACHE_KEY_CSS_DECLARATION_BLOCK
*
* @return void
*
* @throws InvalidArgumentException
*/
private function clearCache($key) {
@ -187,8 +179,6 @@ class Emogrifier {
/**
* Purges the visited nodes.
*
* @return void
*/
private function purgeVisitedNodes() {
$this->visitedNodes = array();
@ -204,8 +194,6 @@ class Emogrifier {
* Note: The tags will not be removed if they have any content.
*
* @param string $tagName the tag name, e.g., "p"
*
* @return void
*/
public function addUnprocessableHtmlTag($tagName) {
$this->unprocessableHtmlTags[] = $tagName;
@ -215,8 +203,6 @@ class Emogrifier {
* Drops a tag from the removal list.
*
* @param string $tagName the tag name, e.g., "p"
*
* @return void
*/
public function removeUnprocessableHtmlTag($tagName) {
$key = array_search($tagName, $this->unprocessableHtmlTags, true);
@ -391,7 +377,6 @@ class Emogrifier {
*
* @param array $cssParts
* @param DOMDocument $xmlDocument
* @return void
*/
public function copyCssWithMediaToStyleNode(array $cssParts, DOMDocument $xmlDocument) {
if (isset($cssParts['media']) && $cssParts['media'] !== '') {
@ -427,7 +412,6 @@ class Emogrifier {
*
* @param DOMDocument $document
* @param string $css
* @return void
*/
private function addStyleElementToDocument(DOMDocument $document, $css) {
$styleElement = $document->createElement('style', $css);

View File

@ -73,7 +73,12 @@ class WC_Eval_Math {
}
}
// Convert infix to postfix notation
/**
* Convert infix to postfix notation
*
* @param string $expr
* @return string
*/
private static function nfx( $expr ) {
$index = 0;

View File

@ -33,8 +33,6 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
/**
* init function.
*
* @return void
*/
public function init() {

View File

@ -26,10 +26,7 @@ class WC_Shipping_International_Delivery extends WC_Shipping_Flat_Rate {
}
/**
* Initialise Gateway Settings Form Fields
*
* @access public
* @return void
* Initialise settings form fields
*/
public function init_form_fields() {
parent::init_form_fields();

View File

@ -81,10 +81,7 @@ class WC_Shipping_Local_Delivery extends WC_Shipping_Local_Pickup {
}
/**
* init_form_fields function.
*
* @access public
* @return void
* Init form fields.
*/
public function init_form_fields() {
$this->form_fields = array(

View File

@ -14,7 +14,6 @@ class WC_Shortcode_Checkout {
/**
* Get the shortcode content.
*
* @access public
* @param array $atts
* @return string
*/
@ -25,9 +24,7 @@ class WC_Shortcode_Checkout {
/**
* Output the shortcode.
*
* @access public
* @param array $atts
* @return void
*/
public static function output( $atts ) {
global $wp;

View File

@ -14,7 +14,6 @@ class WC_Shortcode_My_Account {
/**
* Get the shortcode content.
*
* @access public
* @param array $atts
* @return string
*/
@ -25,9 +24,7 @@ class WC_Shortcode_My_Account {
/**
* Output the shortcode.
*
* @access public
* @param array $atts
* @return void
*/
public static function output( $atts ) {
global $wp;
@ -335,10 +332,8 @@ class WC_Shortcode_My_Account {
/**
* Handles resetting the user's password.
*
* @access public
* @param object $user The user
* @param string $new_pass New password for the user in plaintext
* @return void
*/
public static function reset_password( $user, $new_pass ) {
do_action( 'password_reset', $user, $new_pass );

View File

@ -14,7 +14,6 @@ class WC_Shortcode_Order_Tracking {
/**
* Get the shortcode content.
*
* @access public
* @param array $atts
* @return string
*/
@ -25,9 +24,7 @@ class WC_Shortcode_Order_Tracking {
/**
* Output the shortcode.
*
* @access public
* @param array $atts
* @return void
*/
public static function output( $atts ) {

View File

@ -2,10 +2,10 @@
/**
* Update WC to 2.4.0
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin/Updates
* @version 2.4.0
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin/Updates
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -93,7 +93,8 @@ foreach ( $api_users as $_user ) {
'user_id' => $user->ID,
'permission' => $user->woocommerce_api_key_permissions,
'consumer_key' => wc_api_hash( $user->woocommerce_api_consumer_key ),
'consumer_secret' => $user->woocommerce_api_consumer_secret
'consumer_secret' => $user->woocommerce_api_consumer_secret,
'truncated_key' => substr( $user->woocommerce_api_consumer_secret, -7 )
);
}
@ -107,6 +108,7 @@ if ( ! empty( $apps_keys ) ) {
'%d',
'%s',
'%s',
'%s',
'%s'
)
);

View File

@ -113,7 +113,6 @@ function wc_format_list_of_items( $items ) {
* Clear cart after payment.
*
* @access public
* @return void
*/
function wc_clear_cart_after_payment() {
global $wp;
@ -159,7 +158,6 @@ function wc_cart_totals_subtotal_html() {
* Get shipping methods
*
* @access public
* @return void
*/
function wc_cart_totals_shipping_html() {
$packages = WC()->shipping->get_packages();
@ -175,7 +173,6 @@ function wc_cart_totals_shipping_html() {
* Get taxes total
*
* @access public
* @return void
*/
function wc_cart_totals_taxes_total_html() {
echo apply_filters( 'woocommerce_cart_totals_taxes_total_html', wc_price( WC()->cart->get_taxes_total() ) );
@ -186,7 +183,6 @@ function wc_cart_totals_taxes_total_html() {
*
* @access public
* @param string $coupon
* @return void
*/
function wc_cart_totals_coupon_label( $coupon ) {
if ( is_string( $coupon ) )
@ -200,7 +196,6 @@ function wc_cart_totals_coupon_label( $coupon ) {
*
* @access public
* @param string $coupon
* @return void
*/
function wc_cart_totals_coupon_html( $coupon ) {
if ( is_string( $coupon ) ) {
@ -232,7 +227,6 @@ function wc_cart_totals_coupon_html( $coupon ) {
* Get order total html including inc tax if needed
*
* @access public
* @return void
*/
function wc_cart_totals_order_total_html() {
$value = '<strong>' . WC()->cart->get_total() . '</strong> ';
@ -260,7 +254,6 @@ function wc_cart_totals_order_total_html() {
* Get the fee value
*
* @param object $fee
* @return void
*/
function wc_cart_totals_fee_html( $fee ) {
$cart_totals_fee_html = ( 'excl' == WC()->cart->tax_display_cart ) ? wc_price( $fee->amount ) : wc_price( $fee->amount + $fee->tax );

View File

@ -137,7 +137,6 @@ function wc_update_order( $args ) {
* @access public
* @param mixed $slug
* @param string $name (default: '')
* @return void
*/
function wc_get_template_part( $slug, $name = '' ) {
$template = '';
@ -175,7 +174,6 @@ function wc_get_template_part( $slug, $name = '' ) {
* @param array $args (default: array())
* @param string $template_path (default: '')
* @param string $default_path (default: '')
* @return void
*/
function wc_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
if ( $args && is_array( $args ) ) {
@ -681,7 +679,7 @@ add_filter( 'mod_rewrite_rules', 'wc_ms_protect_download_rewite_rules' );
* WooCommerce Core Supported Themes
*
* @since 2.2
* @return array
* @return string[]
*/
function wc_get_core_supported_themes() {
return array( 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' );

View File

@ -90,7 +90,6 @@ function woocommerce_get_formatted_product_name( $product ) {
* Handle IPN requests for the legacy paypal gateway by calling gateways manually if needed.
*
* @access public
* @return void
*/
function woocommerce_legacy_paypal_ipn() {
if ( ! empty( $_GET['paypalListener'] ) && $_GET['paypalListener'] == 'paypal_standard_IPN' ) {
@ -671,7 +670,6 @@ function woocommerce_track_product_view() {
*
* @since 2.2
* @param WP_Query $q
* @return void
*/
function wc_shop_order_status_backwards_compatibility( $q ) {
if ( $q->is_main_query() ) {
@ -719,7 +717,6 @@ add_action( 'pre_get_posts', 'wc_shop_order_status_backwards_compatibility' );
/**
* @since 2.3
* @deprecated has no replacement
* @return void
*/
function woocommerce_compile_less_styles() {
_deprecated_function( 'woocommerce_compile_less_styles', '2.3' );

View File

@ -300,7 +300,6 @@ function wc_downloadable_file_permission( $download_id, $product_id, $order, $qt
*
* @access public
* @param int $order_id
* @return void
*/
function wc_downloadable_product_permissions( $order_id ) {
if ( get_post_meta( $order_id, '_download_permissions_granted', true ) == 1 ) {
@ -482,7 +481,6 @@ function wc_get_order_item_meta( $item_id, $key, $single = true ) {
* Cancel all unpaid orders after held duration to prevent stock lock for those products
*
* @access public
* @return void
*/
function wc_cancel_unpaid_orders() {
global $wpdb;
@ -721,11 +719,11 @@ function wc_create_refund( $args = array() ) {
// Figure out if this is just a partial refund
$max_remaining_refund = wc_format_decimal( $order->get_total() - $order->get_total_refunded() );
if ( $max_remaining_refund > 0 ) {
do_action( 'woocommerce_order_partially_refunded', $args['order_id'], true, $refund_id );
}
do_action( 'woocommerce_refund_created', $refund_id, $args );
}

View File

@ -341,7 +341,6 @@ function wc_get_formatted_variation( $variation, $flat = false ) {
* Function which handles the start and end of scheduled sales via cron.
*
* @access public
* @return void
*/
function wc_scheduled_sales() {
global $wpdb;

View File

@ -16,8 +16,6 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* Handle redirects before content is output - hooked into template_redirect so is_page works.
*
* @return void
*/
function wc_template_redirect() {
global $wp_query, $wp;
@ -123,7 +121,6 @@ add_filter( 'loop_end', 'woocommerce_reset_loop' );
* Products RSS Feed.
*
* @access public
* @return void
*/
function wc_products_rss_feed() {
// Product RSS
@ -156,7 +153,6 @@ function wc_products_rss_feed() {
* Output generator tag to aid debugging.
*
* @access public
* @return void
*/
function wc_generator_tag( $gen, $type ) {
switch ( $type ) {
@ -423,14 +419,17 @@ if ( ! function_exists( 'woocommerce_demo_store' ) ) {
*
*/
function woocommerce_demo_store() {
if ( !is_store_notice_showing() )
if ( ! is_store_notice_showing() ) {
return;
}
$notice = get_option( 'woocommerce_demo_store_notice' );
if ( empty( $notice ) )
$notice = __( 'This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce' );
echo apply_filters( 'woocommerce_demo_store', '<p class="demo_store">' . $notice . '</p>' );
if ( empty( $notice ) ) {
$notice = __( 'This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce' );
}
echo apply_filters( 'woocommerce_demo_store', '<p class="demo_store">' . wp_kses_post( $notice ) . '</p>' );
}
}

View File

@ -198,8 +198,6 @@ function wc_walk_category_dropdown_tree() {
/**
* WooCommerce Term/Order item Meta API - set table name
*
* @return void
*/
function wc_taxonomy_metadata_wpdbfix() {
global $wpdb;
@ -458,11 +456,11 @@ add_filter( 'terms_clauses', 'wc_terms_clauses', 10, 3 );
/**
* Function for recounting product terms, ignoring hidden products.
*
* @param array $terms
* @param string $taxonomy
* @param boolean $callback
* @param boolean $terms_are_term_taxonomy_ids
* @return void
*/
function _wc_term_recount( $terms, $taxonomy, $callback = true, $terms_are_term_taxonomy_ids = true ) {
global $wpdb;
@ -554,8 +552,8 @@ function _wc_term_recount( $terms, $taxonomy, $callback = true, $terms_are_term_
/**
* Recount terms after the stock amount changes
* @param int $product_id
* @return void
*
* @param int $product_id
*/
function wc_recount_after_stock_change( $product_id ) {
if ( get_option( 'woocommerce_hide_out_of_stock_items' ) != 'yes' )

View File

@ -120,8 +120,7 @@ function wc_create_new_customer( $email, $username = '', $password = '' ) {
/**
* Login a customer (set auth cookie and set global user object)
*
* @param int $customer_id
* @return void
* @param int $customer_id
*/
function wc_set_customer_auth_cookie( $customer_id ) {
global $current_user;
@ -188,7 +187,6 @@ function wc_update_new_customer_past_orders( $customer_id ) {
*
* @access public
* @param int $order_id
* @return void
*/
function wc_paying_customer( $order_id ) {
$order = wc_get_order( $order_id );

View File

@ -48,8 +48,6 @@ class WC_Widget_Cart extends WC_Widget {
*
* @param array $args
* @param array $instance
*
* @return void
*/
public function widget( $args, $instance ) {
if ( is_cart() || is_checkout() ) {

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