Merge branch 'master' into shipping-zones

# Conflicts:
#	includes/admin/class-wc-admin-assets.php
#	includes/class-wc-install.php
This commit is contained in:
Mike Jolley 2016-01-04 14:35:45 +00:00
commit 62ca37f651
75 changed files with 1358 additions and 1244 deletions

View File

@ -7,6 +7,7 @@ php:
- 5.4
- 5.5
- 5.6
- 7.0
env:
- WP_VERSION=latest WP_MULTISITE=0

View File

@ -1,5 +1,27 @@
== Changelog ==
= 2.4.12 - 9/12/2015 =
* Fix - 4.4 - Permission error when editing attribute terms.
* Fix - 4.4 - Missing variation images when wp_get_attachment_image_srcset() returns false instead of a string.
* Fix - 4.4 - Use post-thumbnail size in admin to avoid srcset.
* Fix - Webhook status not changed after save with active object-cache.
= 2.4.11 - 7/12/2015 =
* Fix - WordPress 4.4 support.
* Fix - Removes Switzerland from EU VAT definition.
* Fix - Fix auth endpoint urls.
* Fix - To allow backslash in SKUs.
* Fix - Sanity check for min/max quantity.
* Fix - 4.4 - Shipping class menu display.
* Fix - 4.4 - Admin menu icons and styling.
* Fix - API - Variable product backorders editing.
* Fix - API - Delete product transients when delete a variable product.
* Fix - API - Returned status when have an invalid oAuth timestamp.
* Fix - API - Early call of order status when editing orders.
* Tweak - 4.4 - Basic support for product embeds.
* Tweak - 4.4 - Support for srcset/sizes and responsive images.
* Tweak - 4.4 - Support for Twenty Sixteen.
= 2.4.10 - 10/11/2015 =
* Fix - Geo IP - Correctly parse .dat files.
* Fix - Geo IP - Ensure WC_Logger class exists before logging errors.

View File

@ -5,15 +5,16 @@ Welcome to the WooCommerce repository on GitHub. Here you can browse the source,
If you are not a developer, please use the [WooCommerce plugin page](http://wordpress.org/plugins/woocommerce/) on WordPress.org.
## Documentation
* The [WooCommerce docs site](http://docs.woothemes.com/documentation/plugins/woocommerce/)
* [WooCommerce API Docs](http://docs.woothemes.com/wc-apidocs/)
* [WooCommerce Documentation](http://docs.woothemes.com/documentation/plugins/woocommerce/)
* [WooCommerce Knowledge Base](https://support.woothemes.com/hc/en-us/categories/200146917-WooCommerce)
* [WooCommerce Code Reference](http://docs.woothemes.com/wc-apidocs/)
* [WooCommerce REST API Docs](http://woothemes.github.io/woocommerce-rest-api-docs/)
## Support
This repository is not suitable for support. Please don't use our issue tracker for support requests, but for core WooCommerce issues only. Support can take place in the appropriate channels:
* The [WooThemes premium support portal](http://support.woothemes.com/) for customers who have purchased themes or extensions.
* [Our public HelpDesk](https://support.woothemes.com/hc/communities/public/topics) which is available for all WooCommerce users.
* [Our community forum on wp.org](https://wordpress.org/support/plugin/woocommerce) which is available for all WooCommerce users.
Support requests in issues on this repository will be closed on sight.

File diff suppressed because one or more lines are too long

View File

@ -320,6 +320,7 @@
.wc-terms-and-conditions, .terms {
text-align: left;
padding: 0 1em 0 0;
float:left;
}
#place_order {

View File

@ -485,7 +485,7 @@ jQuery( function( $ ) {
}
});
file_path_field.val( file_path );
file_path_field.val( file_path ).change();
});
// Set post to 0 and set our custom type

File diff suppressed because one or more lines are too long

View File

@ -62,14 +62,33 @@
return rates;
},
save: function() {
$.post( ajaxurl + '?action=woocommerce_tax_rates_save_changes', {
current_class : data.current_class,
wc_tax_nonce : data.wc_tax_nonce,
changes : this.changes
}, this.onSaveResponse, 'json' );
block: function() {
$( '.wc_tax_rates' ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
},
onSaveResponse: function( response, textStatus ) {
unblock: function() {
$( '.wc_tax_rates' ).unblock();
},
save: function() {
var self = this;
self.block();
Backbone.ajax({
method: 'POST',
dataType: 'json',
url: ajaxurl + '?action=woocommerce_tax_rates_save_changes',
data: {
current_class: data.current_class,
wc_tax_nonce: data.wc_tax_nonce,
changes: self.changes
},
success: function( response, textStatus ) {
if ( 'success' === textStatus ) {
WCTaxTableModelInstance.set( 'rates', response.data.rates );
WCTaxTableModelInstance.trigger( 'change:rates' );
@ -77,6 +96,10 @@
WCTaxTableModelInstance.changes = {};
WCTaxTableModelInstance.trigger( 'saved:rates' );
}
self.unblock();
}
});
}
} ),
WCTaxTableViewConstructor = Backbone.View.extend({
@ -91,7 +114,7 @@
this.listenTo( this.model, 'change:rates', this.setUnloadConfirmation );
this.listenTo( this.model, 'saved:rates', this.clearUnloadConfirmation );
$tbody.on( 'change', { view: this }, this.updateModelOnChange );
$tbody.on( 'change', ':input', { view: this }, this.updateModelOnChange );
$tbody.on( 'sortupdate', { view: this }, this.updateModelOnSort );
$search_field.on( 'keyup search', { view: this }, this.onSearchField );
$pagination.on( 'click', 'a', { view: this }, this.onPageChange );

File diff suppressed because one or more lines are too long

View File

@ -95,7 +95,9 @@ jQuery( function( $ ) {
term: term,
action: $( this ).data( 'action' ) || 'woocommerce_json_search_products_and_variations',
security: wc_enhanced_select_params.search_products_nonce,
exclude: $( this ).data( 'exclude' )
exclude: $( this ).data( 'exclude' ),
include: $( this ).data( 'include' ),
limit: $( this ).data( 'limit' )
};
},
results: function( data ) {

View File

@ -1 +1 @@
jQuery(function(a){function b(){var a={formatMatches:function(a){return 1===a?wc_enhanced_select_params.i18n_matches_1:wc_enhanced_select_params.i18n_matches_n.replace("%qty%",a)},formatNoMatches:function(){return wc_enhanced_select_params.i18n_no_matches},formatAjaxError:function(){return wc_enhanced_select_params.i18n_ajax_error},formatInputTooShort:function(a,b){var c=b-a.length;return 1===c?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",c)},formatInputTooLong:function(a,b){var c=a.length-b;return 1===c?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",c)},formatSelectionTooBig:function(a){return 1===a?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",a)},formatLoadMore:function(){return wc_enhanced_select_params.i18n_load_more},formatSearching:function(){return wc_enhanced_select_params.i18n_searching}};return a}a(document.body).on("wc-enhanced-select-init",function(){a(":input.wc-enhanced-select, :input.chosen_select").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:a(this).data("allow_clear")?!0:!1,placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.wc-enhanced-select-nostd, :input.chosen_select_nostd").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:!0,placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.wc-product-search").filter(":not(.enhanced)").each(function(){var c={allowClear:a(this).data("allow_clear")?!0:!1,placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(b){return{term:b,action:a(this).data("action")||"woocommerce_json_search_products_and_variations",security:wc_enhanced_select_params.search_products_nonce,exclude:a(this).data("exclude")}},results:function(b){var c=[];return b&&a.each(b,function(a,b){c.push({id:a,text:b})}),{results:c}},cache:!0}};a(this).data("multiple")===!0?(c.multiple=!0,c.initSelection=function(b,c){var d=a.parseJSON(b.attr("data-selected")),e=[];return a(b.val().split(",")).each(function(a,b){e.push({id:b,text:d[b]})}),c(e)},c.formatSelection=function(a){return'<div class="selected-option" data-id="'+a.id+'">'+a.text+"</div>"}):(c.multiple=!1,c.initSelection=function(a,b){var c={id:a.val(),text:a.attr("data-selected")};return b(c)}),c=a.extend(c,b()),a(this).select2(c).addClass("enhanced")}),a(":input.wc-customer-search").filter(":not(.enhanced)").each(function(){var c={allowClear:a(this).data("allow_clear")?!0:!1,placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(a){return{term:a,action:"woocommerce_json_search_customers",security:wc_enhanced_select_params.search_customers_nonce}},results:function(b){var c=[];return b&&a.each(b,function(a,b){c.push({id:a,text:b})}),{results:c}},cache:!0}};a(this).data("multiple")===!0?(c.multiple=!0,c.initSelection=function(b,c){var d=a.parseJSON(b.attr("data-selected")),e=[];return a(b.val().split(",")).each(function(a,b){e.push({id:b,text:d[b]})}),c(e)},c.formatSelection=function(a){return'<div class="selected-option" data-id="'+a.id+'">'+a.text+"</div>"}):(c.multiple=!1,c.initSelection=function(a,b){var c={id:a.val(),text:a.attr("data-selected")};return b(c)}),c=a.extend(c,b()),a(this).select2(c).addClass("enhanced")})}).on("wc_backbone_modal_before_remove",function(){a(":input.wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search").select2("close")}).trigger("wc-enhanced-select-init")});
jQuery(function(a){function b(){var a={formatMatches:function(a){return 1===a?wc_enhanced_select_params.i18n_matches_1:wc_enhanced_select_params.i18n_matches_n.replace("%qty%",a)},formatNoMatches:function(){return wc_enhanced_select_params.i18n_no_matches},formatAjaxError:function(){return wc_enhanced_select_params.i18n_ajax_error},formatInputTooShort:function(a,b){var c=b-a.length;return 1===c?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",c)},formatInputTooLong:function(a,b){var c=a.length-b;return 1===c?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",c)},formatSelectionTooBig:function(a){return 1===a?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",a)},formatLoadMore:function(){return wc_enhanced_select_params.i18n_load_more},formatSearching:function(){return wc_enhanced_select_params.i18n_searching}};return a}a(document.body).on("wc-enhanced-select-init",function(){a(":input.wc-enhanced-select, :input.chosen_select").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:a(this).data("allow_clear")?!0:!1,placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.wc-enhanced-select-nostd, :input.chosen_select_nostd").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:!0,placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.wc-product-search").filter(":not(.enhanced)").each(function(){var c={allowClear:a(this).data("allow_clear")?!0:!1,placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(b){return{term:b,action:a(this).data("action")||"woocommerce_json_search_products_and_variations",security:wc_enhanced_select_params.search_products_nonce,exclude:a(this).data("exclude"),include:a(this).data("include"),limit:a(this).data("limit")}},results:function(b){var c=[];return b&&a.each(b,function(a,b){c.push({id:a,text:b})}),{results:c}},cache:!0}};a(this).data("multiple")===!0?(c.multiple=!0,c.initSelection=function(b,c){var d=a.parseJSON(b.attr("data-selected")),e=[];return a(b.val().split(",")).each(function(a,b){e.push({id:b,text:d[b]})}),c(e)},c.formatSelection=function(a){return'<div class="selected-option" data-id="'+a.id+'">'+a.text+"</div>"}):(c.multiple=!1,c.initSelection=function(a,b){var c={id:a.val(),text:a.attr("data-selected")};return b(c)}),c=a.extend(c,b()),a(this).select2(c).addClass("enhanced")}),a(":input.wc-customer-search").filter(":not(.enhanced)").each(function(){var c={allowClear:a(this).data("allow_clear")?!0:!1,placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(a){return{term:a,action:"woocommerce_json_search_customers",security:wc_enhanced_select_params.search_customers_nonce}},results:function(b){var c=[];return b&&a.each(b,function(a,b){c.push({id:a,text:b})}),{results:c}},cache:!0}};a(this).data("multiple")===!0?(c.multiple=!0,c.initSelection=function(b,c){var d=a.parseJSON(b.attr("data-selected")),e=[];return a(b.val().split(",")).each(function(a,b){e.push({id:b,text:d[b]})}),c(e)},c.formatSelection=function(a){return'<div class="selected-option" data-id="'+a.id+'">'+a.text+"</div>"}):(c.multiple=!1,c.initSelection=function(a,b){var c={id:a.val(),text:a.attr("data-selected")};return b(c)}),c=a.extend(c,b()),a(this).select2(c).addClass("enhanced")})}).on("wc_backbone_modal_before_remove",function(){a(":input.wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search").select2("close")}).trigger("wc-enhanced-select-init")});

View File

@ -129,11 +129,12 @@ jQuery( function ( $ ) {
var hasFocus = false;
$( document.body ).bind( 'keyup keydown', function( e ) {
shifted = e.shiftKey; controlled = e.ctrlKey || e.metaKey;
shifted = e.shiftKey;
controlled = e.ctrlKey || e.metaKey;
});
$( '.wc_input_table' ).on( 'focus click', 'input', function( e ) {
var $this_table = $( this ).closest( 'table' );
var $this_table = $( this ).closest( 'table, tbody' );
var $this_row = $( this ).closest( 'tr' );
if ( ( e.type === 'focus' && hasFocus !== $this_row.index() ) || ( e.type === 'click' && $( this ).is( ':focus' ) ) ) {

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,7 @@ jQuery( function( $ ) {
this.$checkout_form.on( 'change', 'select.shipping_method, input[name^="shipping_method"], #ship-to-different-address input, .update_totals_on_change select, .update_totals_on_change input[type="radio"]', this.trigger_update_checkout );
this.$checkout_form.on( 'change', '.address-field select', this.input_changed );
this.$checkout_form.on( 'change', '.address-field input.input-text, .update_totals_on_change input.input-text', this.maybe_input_changed );
this.$checkout_form.on( 'keydown', '.address-field input.input-text, .update_totals_on_change input.input-text', this.queue_update_checkout );
this.$checkout_form.on( 'change keydown', '.address-field input.input-text, .update_totals_on_change input.input-text', this.queue_update_checkout );
// Address fields
this.$checkout_form.on( 'change', '#ship-to-different-address input', this.ship_to_different_address );

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -13,17 +13,17 @@ $states['MY'] = array(
'JHR' => __( 'Johor', 'woocommerce' ),
'KDH' => __( 'Kedah', 'woocommerce' ),
'KTN' => __( 'Kelantan', 'woocommerce' ),
'MLK' => __( 'Melaka', 'woocommerce' ),
'LBN' => __( 'Labuan', 'woocommerce' ),
'MLK' => __( 'Malacca (Melaka)', 'woocommerce' ),
'NSN' => __( 'Negeri Sembilan', 'woocommerce' ),
'PHG' => __( 'Pahang', 'woocommerce' ),
'PNG' => __( 'Penang (Pulau Pinang)', 'woocommerce' ),
'PRK' => __( 'Perak', 'woocommerce' ),
'PLS' => __( 'Perlis', 'woocommerce' ),
'PNG' => __( 'Pulau Pinang', 'woocommerce' ),
'SBH' => __( 'Sabah', 'woocommerce' ),
'SWK' => __( 'Sarawak', 'woocommerce' ),
'SGR' => __( 'Selangor', 'woocommerce' ),
'TRG' => __( 'Terengganu', 'woocommerce' ),
'KUL' => __( 'W.P. Kuala Lumpur', 'woocommerce' ),
'LBN' => __( 'W.P. Labuan', 'woocommerce' ),
'PJY' => __( 'W.P. Putrajaya', 'woocommerce' )
'PJY' => __( 'Putrajaya', 'woocommerce' ),
'KUL' => __( 'Kuala Lumpur', 'woocommerce' )
);

View File

@ -683,6 +683,9 @@ abstract class WC_Abstract_Order {
}
// Now calculate shipping tax
$shipping_methods = $this->get_shipping_methods();
if ( ! empty( $shipping_methods ) ) {
$matched_tax_rates = array();
$tax_rates = WC_Tax::find_rates( array(
'country' => $country,
@ -702,6 +705,10 @@ abstract class WC_Abstract_Order {
$shipping_taxes = WC_Tax::calc_shipping_tax( $this->order_shipping, $matched_tax_rates );
$shipping_tax_total = WC_Tax::round( array_sum( $shipping_taxes ) );
} else {
$shipping_taxes = array();
$shipping_tax_total = 0;
}
// Save tax totals
$this->set_total( $shipping_tax_total, 'shipping_tax' );
@ -1386,7 +1393,7 @@ abstract class WC_Abstract_Order {
$total_discount = (double) $this->cart_discount + (double) $this->cart_discount_tax;
}
}
return apply_filters( 'woocommerce_order_amount_total_discount', $total_discount, $this );
return apply_filters( 'woocommerce_order_amount_total_discount', round( $total_discount, WC_ROUNDING_PRECISION ), $this );
}
/**
@ -1924,14 +1931,19 @@ abstract class WC_Abstract_Order {
/**
* Output items for display in html emails.
* @param array $args
* @param bool plain text
*
* @param array $args Items args.
* @param null $deprecated1 Deprecated arg.
* @param null $deprecated2 Deprecated arg.
* @param null $deprecated3 Deprecated arg.
* @param null $deprecated4 Deprecated arg.
* @param null $deprecated5 Deprecated arg.
* @return string
*/
public function email_order_items_table( $args = array(), $deprecated = null, $deprecated = null, $deprecated = null, $deprecated = null, $deprecated = null ) {
public function email_order_items_table( $args = array(), $deprecated1 = null, $deprecated2 = null, $deprecated3 = null, $deprecated4 = null, $deprecated5 = null ) {
ob_start();
if ( ! is_null( $deprecated ) ) {
if ( ! is_null( $deprecated1 ) || ! is_null( $deprecated2 ) || ! is_null( $deprecated3 ) || ! is_null( $deprecated4 ) || ! is_null( $deprecated5 ) ) {
_deprecated_argument( __FUNCTION__, '2.5.0' );
}

View File

@ -183,7 +183,7 @@ class WC_Product {
* @return array
*/
public function get_gallery_attachment_ids() {
return apply_filters( 'woocommerce_product_gallery_attachment_ids', array_filter( (array) explode( ',', $this->product_image_gallery ) ), $this );
return apply_filters( 'woocommerce_product_gallery_attachment_ids', array_filter( array_filter( (array) explode( ',', $this->product_image_gallery ) ), 'wp_attachment_is_image' ), $this );
}
/**

View File

@ -170,6 +170,11 @@ abstract class WC_Widget extends WP_Widget {
$instance[ $key ] = sanitize_text_field( $new_instance[ $key ] );
break;
}
/**
* Sanitize the value of a setting.
*/
$instance[ $key ] = apply_filters( 'woocommerce_widget_settings_sanitize_option', $instance[ $key ], $new_instance, $key, $setting );
}
$this->flush_widget_cache();
@ -247,6 +252,11 @@ abstract class WC_Widget extends WP_Widget {
</p>
<?php
break;
// Default: run an action
default :
do_action( 'woocommerce_widget_field_' . $setting['type'], $key, $value, $setting, $instance );
break;
}
}
}

View File

@ -9,7 +9,7 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
/**
@ -17,32 +17,93 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
class WC_Admin_Addons {
/**
* Get sections for the addons screen
* @return array of objects
*/
public static function get_sections() {
if ( false === ( $sections = get_transient( 'wc_addons_sections' ) ) ) {
$raw_sections = wp_safe_remote_get( 'https://d3t0oesq8995hv.cloudfront.net/addon-sections.json', array( 'user-agent' => 'WooCommerce Addons Page' ) );
if ( ! is_wp_error( $raw_sections ) ) {
$sections = json_decode( wp_remote_retrieve_body( $raw_sections ) );
if ( $sections ) {
set_transient( 'wc_addons_sections', $sections, WEEK_IN_SECONDS );
}
}
}
$addon_sections = array();
if ( $sections ) {
foreach ( $sections as $sections_id => $section ) {
if ( empty( $sections_id ) ) {
continue;
}
$addon_sections[ $sections_id ] = new stdClass;
$addon_sections[ $sections_id ]->title = wc_clean( $section->title );
$addon_sections[ $sections_id ]->endpoint = wc_clean( $section->endpoint );
}
}
return apply_filters( 'woocommerce_addons_sections', $addon_sections );
}
/**
* Get section for the addons screen
* @return object|bool
*/
public static function get_section( $section_id ) {
$sections = self::get_sections();
if ( isset( $sections[ $section_id ] ) ) {
return $sections[ $section_id ];
}
return false;
}
/**
* Get section content for the addons screen
* @return array
*/
public static function get_section_data( $section_id ) {
$section = self::get_section( $section_id );
$section_data = '';
if ( ! empty( $section->endpoint ) ) {
if ( false === ( $section_data = get_transient( 'wc_addons_section_' . $section_id ) ) ) {
$raw_section = wp_safe_remote_get( esc_url_raw( $section->endpoint ), array( 'user-agent' => 'WooCommerce Addons Page' ) );
if ( ! is_wp_error( $raw_section ) ) {
$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );
if ( ! empty( $section_data->products ) ) {
set_transient( 'wc_addons_section_' . $section_id, $section_data, WEEK_IN_SECONDS );
}
}
}
}
return apply_filters( 'woocommerce_addons_section_data', $section_data->products, $section_id );
}
/**
* Handles the outputting of a contextually aware Storefront link (points to child themes if Storefront is already active).
*/
public static function output_storefront_button() {
$url = 'http://www.woothemes.com/storefront/';
$text = __( 'View more about Storefront', 'woocommerce' );
$template = get_option( 'template' );
$stylesheet = get_option( 'stylesheet' );
$utm_content = 'hasstorefront';
// If we're using Storefront with a child theme.
if ( 'storefront' == $template && 'storefront' != $stylesheet ) {
if ( 'storefront' === $template ) {
if ( 'storefront' === $stylesheet ) {
$url = 'http:///www.woothemes.com/product-category/themes/storefront-child-theme-themes/';
$text = __( 'Need a fresh look? Try Storefront child themes', 'woocommerce' );
$utm_content = 'nostorefrontchildtheme';
} else {
$url = 'http:///www.woothemes.com/product-category/themes/storefront-child-theme-themes/';
$text = __( 'View more Storefront child themes', 'woocommerce' );
$utm_content = 'hasstorefrontchildtheme';
}
// If we're using Storefront without a child theme.
if ( 'storefront' == $template && 'storefront' == $stylesheet ) {
$url = 'http:///www.woothemes.com/product-category/themes/storefront-child-theme-themes/';
$text = __( 'Need a fresh look? Try Storefront child themes', 'woocommerce' );
$utm_content = 'nostorefrontchildtheme';
}
// If we're not using Storefront at all.
if ( 'storefront' != $template && 'storefront' != $stylesheet ) {
} else {
$url = 'http://www.woothemes.com/storefront/';
$text = __( 'Need a theme? Try Storefront', 'woocommerce' );
$utm_content = 'nostorefront';
@ -59,24 +120,13 @@ class WC_Admin_Addons {
}
/**
* Handles output of the reports page in admin.
* Handles output of the addons page in admin.
*/
public static function output() {
if ( false === ( $addons = get_transient( 'woocommerce_addons_data' ) ) ) {
$addons_json = wp_safe_remote_get( 'http://d3t0oesq8995hv.cloudfront.net/woocommerce-addons.json', array( 'user-agent' => 'WooCommerce Addons Page' ) );
if ( ! is_wp_error( $addons_json ) ) {
$addons = json_decode( wp_remote_retrieve_body( $addons_json ) );
if ( $addons ) {
set_transient( 'woocommerce_addons_data', $addons, WEEK_IN_SECONDS );
}
}
}
$sections = self::get_sections();
$theme = wp_get_theme();
$section_keys = array_keys( $sections );
$current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
include_once( 'views/html-admin-page-addons.php' );
}
}

View File

@ -101,7 +101,7 @@ class WC_Admin_Assets {
wp_register_script( 'flot-time', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.time' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
wp_register_script( 'flot-pie', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.pie' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
wp_register_script( 'flot-stack', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.stack' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
wp_register_script( 'wc-settings-tax', WC()->plugin_url() . '/assets/js/admin/settings-views-html-settings-tax' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION );
wp_register_script( 'wc-settings-tax', WC()->plugin_url() . '/assets/js/admin/settings-views-html-settings-tax' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), WC_VERSION );
wp_register_script( 'wc-shipping-zones', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zones' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-enhanced-select' ), WC_VERSION );
wp_register_script( 'wc-shipping-zone-methods', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zone-methods' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable' ), WC_VERSION );
@ -110,7 +110,7 @@ class WC_Admin_Assets {
wp_register_script( 'chosen', WC()->plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
// Select2 is the replacement for chosen
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.2' );
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.4' );
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'select2' ), WC_VERSION );
wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array(
'i18n_matches_1' => _x( 'One result is available, press enter to select it.', 'enhanced select', 'woocommerce' ),

View File

@ -205,11 +205,11 @@ class WC_Admin_Help {
$screen->add_help_tab( array(
'id' => 'woocommerce_onboard_tab',
'title' => __( 'Onboarding Wizard', 'woocommerce' ),
'title' => __( 'Setup Wizard', 'woocommerce' ),
'content' =>
'<h2>' . __( 'Onboarding Wizard', 'woocommerce' ) . '</h2>' .
'<p>' . __( 'If you need to access the onboarding wizard again, please click on the button below.', 'woocommerce' ) . '</p>' .
'<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Onboarding Wizard', 'woocommerce' ) . '</a></p>'
'<h2>' . __( 'Setup Wizard', 'woocommerce' ) . '</h2>' .
'<p>' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '</p>' .
'<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Setup Wizard', 'woocommerce' ) . '</a></p>'
) );

View File

@ -145,7 +145,7 @@ class WC_Admin_Menus {
unset( $submenu['woocommerce'][0] );
// Add count if user has access
if ( current_user_can( 'manage_woocommerce' ) && ( $order_count = wc_processing_order_count() ) ) {
if ( apply_filters( 'woocommerce_include_processing_order_count_in_menu', true ) && current_user_can( 'manage_woocommerce' ) && ( $order_count = wc_processing_order_count() ) ) {
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
if ( 0 === strpos( $menu_item[0], _x( 'Orders', 'Admin menu name', 'woocommerce' ) ) ) {
$submenu['woocommerce'][ $key ][0] .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';

View File

@ -100,7 +100,7 @@ class WC_Admin {
delete_transient( '_wc_activation_redirect' );
if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'wc-setup' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_woocommerce' ) ) {
if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'wc-setup' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_woocommerce' ) || apply_filters( 'woocommerce_prevent_automatic_wizard_redirect', false ) ) {
return;
}

View File

@ -90,7 +90,6 @@ class WC_Meta_Box_Order_Downloads {
$access_expires = $_POST['access_expires'];
// Order data
$order_key = get_post_meta( $post->ID, '_order_key', true );
$customer_email = get_post_meta( $post->ID, '_billing_email', true );
$customer_user = get_post_meta( $post->ID, '_customer_user', true );
$product_ids_max = max( array_keys( $product_ids ) );

View File

@ -984,7 +984,6 @@ class WC_Meta_Box_Product_Data {
update_post_meta( $post_id, '_sale_price', '' );
update_post_meta( $post_id, '_sale_price_dates_from', '' );
update_post_meta( $post_id, '_sale_price_dates_to', '' );
update_post_meta( $post_id, '_price', '' );
} else {
$date_from = isset( $_POST['_sale_price_dates_from'] ) ? wc_clean( $_POST['_sale_price_dates_from'] ) : '';

View File

@ -87,6 +87,7 @@ if ( wc_tax_enabled() ) {
do_action( 'woocommerce_order_item_' . $item['type'] . '_html', $item_id, $item, $order );
}
do_action( 'woocommerce_admin_order_items_after_line_items', $order->id );
?>
</tbody>
<tbody id="order_shipping_line_items">
@ -95,6 +96,7 @@ if ( wc_tax_enabled() ) {
foreach ( $line_items_shipping as $item_id => $item ) {
include( 'html-order-shipping.php' );
}
do_action( 'woocommerce_admin_order_items_after_shipping', $order->id );
?>
</tbody>
<tbody id="order_fee_line_items">
@ -102,6 +104,7 @@ if ( wc_tax_enabled() ) {
foreach ( $line_items_fee as $item_id => $item ) {
include( 'html-order-fee.php' );
}
do_action( 'woocommerce_admin_order_items_after_fees', $order->id );
?>
</tbody>
<tbody id="order_refunds">
@ -110,6 +113,7 @@ if ( wc_tax_enabled() ) {
foreach ( $refunds as $refund ) {
include( 'html-order-refund.php' );
}
do_action( 'woocommerce_admin_order_items_after_refunds', $order->id );
}
?>
</tbody>
@ -137,7 +141,7 @@ if ( wc_tax_enabled() ) {
?>
<table class="wc-order-totals">
<tr>
<td class="label"><?php _e( 'Discount', 'woocommerce' ); ?> <span class="tips" data-tip="<?php esc_attr_e( 'This is the total discount. Discounts are defined per line item.', 'woocommerce' ); ?>">[?]</span>:</td>
<td class="label"><?php echo wc_help_tip( __( 'This is the total discount. Discounts are defined per line item.', 'woocommerce' ) ); ?> <?php _e( 'Discount', 'woocommerce' ); ?>:</td>
<td class="total">
<?php echo wc_price( $order->get_total_discount(), array( 'currency' => $order->get_order_currency() ) ); ?>
</td>
@ -147,7 +151,7 @@ if ( wc_tax_enabled() ) {
<?php do_action( 'woocommerce_admin_order_totals_after_discount', $order->id ); ?>
<tr>
<td class="label"><?php _e( 'Shipping', 'woocommerce' ); ?> <span class="tips" data-tip="<?php esc_attr_e( 'This is the shipping and handling total costs for the order.', 'woocommerce' ); ?>">[?]</span>:</td>
<td class="label"><?php echo wc_help_tip( __( 'This is the shipping and handling total costs for the order.', 'woocommerce' ) ); ?> <?php _e( 'Shipping', 'woocommerce' ); ?>:</td>
<td class="total"><?php
if ( ( $refunded = $order->get_total_shipping_refunded() ) > 0 ) {
echo '<del>' . strip_tags( wc_price( $order->get_total_shipping(), array( 'currency' => $order->get_order_currency() ) ) ) . '</del> <ins>' . wc_price( $order->get_total_shipping() - $refunded, array( 'currency' => $order->get_order_currency() ) ) . '</ins>';
@ -189,7 +193,13 @@ if ( wc_tax_enabled() ) {
<div class="clear"></div>
</div>
</td>
<td><?php if ( $order->is_editable() ) : ?><div class="wc-order-edit-line-item-actions"><a class="edit-order-item" href="#"></a></div><?php endif; ?></td>
<td>
<?php if ( $order->is_editable() ) : ?>
<div class="wc-order-edit-line-item-actions">
<a class="edit-order-item" href="#"></a>
</div>
<?php endif; ?>
</td>
</tr>
<?php do_action( 'woocommerce_admin_order_totals_after_total', $order->id ); ?>

View File

@ -142,7 +142,7 @@ extract( $variation_data );
<?php
/**
* woocommerce_product_options_inventory action.
* woocommerce_variation_options_inventory action.
*
* @since 2.5.0
*
@ -150,7 +150,7 @@ extract( $variation_data );
* @param array $variation_data
* @param WP_Post $variation
*/
do_action( 'woocommerce_product_options_inventory', $loop, $variation_data, $variation );
do_action( 'woocommerce_variation_options_inventory', $loop, $variation_data, $variation );
?>
</div>
<?php endif; ?>
@ -191,7 +191,7 @@ extract( $variation_data );
<?php
/**
* woocommerce_product_options_dimensions action.
* woocommerce_variation_options_dimensions action.
*
* @since 2.5.0
*
@ -199,7 +199,7 @@ extract( $variation_data );
* @param array $variation_data
* @param WP_Post $variation
*/
do_action( 'woocommerce_product_options_dimensions', $loop, $variation_data, $variation );
do_action( 'woocommerce_variation_options_dimensions', $loop, $variation_data, $variation );
?>
</div>
<?php endif; ?>
@ -231,7 +231,7 @@ extract( $variation_data );
<?php
/**
* woocommerce_product_options_tax action.
* woocommerce_variation_options_tax action.
*
* @since 2.5.0
*
@ -239,7 +239,7 @@ extract( $variation_data );
* @param array $variation_data
* @param WP_Post $variation
*/
do_action( 'woocommerce_product_options_tax', $loop, $variation_data, $variation );
do_action( 'woocommerce_variation_options_tax', $loop, $variation_data, $variation );
?>
<?php endif; ?>
</div>
@ -305,7 +305,7 @@ extract( $variation_data );
<?php
/**
* woocommerce_product_options_download action.
* woocommerce_variation_options_download action.
*
* @since 2.5.0
*
@ -313,7 +313,7 @@ extract( $variation_data );
* @param array $variation_data
* @param WP_Post $variation
*/
do_action( 'woocommerce_product_options_download', $loop, $variation_data, $variation );
do_action( 'woocommerce_variation_options_download', $loop, $variation_data, $variation );
?>
</div>
<?php do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation ); ?>

View File

@ -5,11 +5,11 @@
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
* @version 2.1.0
* @version 2.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
if ( ! class_exists( 'WC_Settings_Payment_Gateways' ) ) :
@ -45,7 +45,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
);
if ( ! defined( 'WC_INSTALLING' ) ) {
// Load shipping methods so we can show any global options they may have
// Load shipping methods so we can show any global options they may have.
$payment_gateways = WC()->payment_gateways->payment_gateways();
foreach ( $payment_gateways as $gateway ) {
@ -65,7 +65,11 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
public function get_settings() {
$settings = apply_filters( 'woocommerce_payment_gateways_settings', array(
array( 'title' => __( 'Checkout Process', 'woocommerce' ), 'type' => 'title', 'id' => 'checkout_process_options' ),
array(
'title' => __( 'Checkout Process', 'woocommerce' ),
'type' => 'title',
'id' => 'checkout_process_options',
),
array(
'title' => __( 'Coupons', 'woocommerce' ),
@ -75,7 +79,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'type' => 'checkbox',
'checkboxgroup' => 'start',
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
'autoload' => false
'autoload' => false,
),
array(
@ -85,7 +89,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'type' => 'checkbox',
'desc_tip' => __( 'When applying multiple coupons, apply the first coupon to the full price and the second coupon to the discounted price and so on.', 'woocommerce' ),
'checkboxgroup' => 'end',
'autoload' => false
'autoload' => false,
),
array(
@ -96,7 +100,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false
'autoload' => false,
),
array(
@ -106,7 +110,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'type' => 'checkbox',
'checkboxgroup' => '',
'show_if_checked' => 'option',
'desc_tip' => __( 'Force SSL (HTTPS) on the checkout pages (a SSL Certificate is required).', 'woocommerce' ),
'desc_tip' => __( 'Force SSL (HTTPS) on the checkout pages (an SSL Certificate is required).', 'woocommerce' ),
),
array(
@ -118,9 +122,17 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'show_if_checked' => 'yes',
),
array( 'type' => 'sectionend', 'id' => 'checkout_process_options'),
array(
'type' => 'sectionend',
'id' => 'checkout_process_options',
),
array( 'title' => __( 'Checkout Pages', 'woocommerce' ), 'desc' => __( 'These pages need to be set so that WooCommerce knows where to send users to checkout.', 'woocommerce' ), 'type' => 'title', 'id' => 'checkout_page_options' ),
array(
'title' => __( 'Checkout Pages', 'woocommerce' ),
'desc' => __( 'These pages need to be set so that WooCommerce knows where to send users to checkout.', 'woocommerce' ),
'type' => 'title',
'id' => 'checkout_page_options',
),
array(
'title' => __( 'Cart Page', 'woocommerce' ),
@ -153,10 +165,13 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'css' => 'min-width:300px;',
'type' => 'single_select_page',
'desc_tip' => true,
'autoload' => false
'autoload' => false,
),
array( 'type' => 'sectionend', 'id' => 'checkout_page_options' ),
array(
'type' => 'sectionend',
'id' => 'checkout_page_options',
),
array( 'title' => __( 'Checkout Endpoints', 'woocommerce' ), 'type' => 'title', 'desc' => __( 'Endpoints are appended to your page URLs to handle specific actions during the checkout process. They should be unique.', 'woocommerce' ), 'id' => 'account_endpoint_options' ),
@ -187,13 +202,26 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
'desc_tip' => true,
),
array( 'type' => 'sectionend', 'id' => 'checkout_endpoint_options' ),
array(
'type' => 'sectionend',
'id' => 'checkout_endpoint_options',
),
array( 'title' => __( 'Payment Gateways', 'woocommerce' ), 'desc' => __( 'Installed gateways are listed below. Drag and drop gateways to control their display order on the frontend.', 'woocommerce' ), 'type' => 'title', 'id' => 'payment_gateways_options' ),
array(
'title' => __( 'Payment Gateways', 'woocommerce' ),
'desc' => __( 'Installed gateways are listed below. Drag and drop gateways to control their display order on the frontend.', 'woocommerce' ),
'type' => 'title',
'id' => 'payment_gateways_options',
),
array( 'type' => 'payment_gateways' ),
array(
'type' => 'payment_gateways',
),
array( 'type' => 'sectionend', 'id' => 'payment_gateways_options' ),
array(
'type' => 'sectionend',
'id' => 'payment_gateways_options',
),
) );
@ -206,7 +234,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
public function output() {
global $current_section;
// Load shipping methods so we can show any global options they may have
// Load shipping methods so we can show any global options they may have.
$payment_gateways = WC()->payment_gateways->payment_gateways();
if ( $current_section ) {
@ -267,15 +295,14 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
break;
case 'name' :
$method_title = $gateway->get_title() ? $gateway->get_title() : __( '(no title)', 'woocommerce' );
echo '<td class="name">
<a href="' . admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . strtolower( get_class( $gateway ) ) ) . '">' . $gateway->get_title() . '</a>
<a href="' . admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . strtolower( get_class( $gateway ) ) ) . '">' . esc_html( $method_title ) . '</a>
</td>';
break;
case 'id' :
echo '<td class="id">
' . esc_html( $gateway->id ) . '
</td>';
echo '<td class="id">' . esc_html( $gateway->id ) . '</td>';
break;
case 'status' :

View File

@ -215,7 +215,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
}
/**
* Output payment gateway settings.
* Output email notification settings.
*/
public function email_notification_setting() {
// Define emails that can be customised here
@ -251,7 +251,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
switch ( $key ) {
case 'name' :
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
<a href="' . admin_url( 'admin.php?page=wc-settings&tab=email&section=' . strtolower( get_class( $email ) ) ) . '">' . $email->get_title() . '</a>
<a href="' . admin_url( 'admin.php?page=wc-settings&tab=email&section=' . strtolower( $email_key ) ) . '">' . $email->get_title() . '</a>
' . wc_help_tip( $email->get_description() ) . '
</td>';
break;
@ -280,7 +280,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
break;
case 'actions' :
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
<a class="button alignright tips" data-tip="' . __( 'Configure', 'woocommerce' ) . '" href="' . admin_url( 'admin.php?page=wc-settings&tab=email&section=' . strtolower( get_class( $email ) ) ) . '">' . __( 'Configure', 'woocommerce' ) . '</a>
<a class="button alignright tips" data-tip="' . __( 'Configure', 'woocommerce' ) . '" href="' . admin_url( 'admin.php?page=wc-settings&tab=email&section=' . strtolower( $email_key ) ) . '">' . __( 'Configure', 'woocommerce' ) . '</a>
</td>';
break;
default :

View File

@ -96,20 +96,6 @@ class WC_Settings_Shipping extends WC_Settings_Page {
'autoload' => false
),
array(
'title' => __( 'Shipping Display Mode', 'woocommerce' ),
'desc' => __( 'This controls how multiple shipping methods are displayed on the frontend.', 'woocommerce' ),
'id' => 'woocommerce_shipping_method_format',
'default' => '',
'type' => 'radio',
'options' => array(
'' => __( 'Display shipping methods with "radio" buttons', 'woocommerce' ),
'select' => __( 'Display shipping methods in a dropdown', 'woocommerce' ),
),
'desc_tip' => true,
'autoload' => false
),
array(
'title' => __( 'Shipping Destination', 'woocommerce' ),
'desc' => __( 'This controls which shipping address is used by default.', 'woocommerce' ),

View File

@ -6,14 +6,9 @@
* @var object $addons
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
$view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : '';
$theme = wp_get_theme();
?>
<div class="wrap woocommerce wc_addons_wrap">
<div class="icon32 icon32-posts-product" id="icon-woocommerce"><br /></div>
<h1>
@ -21,101 +16,44 @@ $theme = wp_get_theme();
<a href="http://www.woothemes.com/product-category/woocommerce-extensions/" class="add-new-h2"><?php _e( 'Browse all extensions', 'woocommerce' ); ?></a>
<?php WC_Admin_Addons::output_storefront_button(); ?>
</h1>
<?php if ( $addons ) : ?>
<?php if ( $sections ) : ?>
<ul class="subsubsub">
<?php
$links = array(
'' => __( 'Popular', 'woocommerce' ),
'payment-gateways' => __( 'Gateways', 'woocommerce' ),
'shipping-methods' => __( 'Shipping', 'woocommerce' ),
'import-export-extensions' => __( 'Import/export', 'woocommerce' ),
'product-extensions' => __( 'Products', 'woocommerce' ),
'marketing-extensions' => __( 'Marketing', 'woocommerce' ),
'accounting-extensions' => __( 'Accounting', 'woocommerce' ),
'free-extensions' => __( 'Free', 'woocommerce' ),
'third-party-extensions' => __( 'Third-party', 'woocommerce' ),
);
$i = 0;
foreach ( $links as $link => $name ) {
$i ++;
?><li><a class="<?php if ( $view == $link ) echo 'current'; ?>" href="<?php echo admin_url( 'admin.php?page=wc-addons&view=' . esc_attr( $link ) ); ?>"><?php echo $name; ?></a><?php if ( $i != sizeof( $links ) ) echo ' |'; ?></li><?php
}
?>
<?php foreach ( $sections as $section_id => $section ) : ?>
<li><a class="<?php echo $current_section === $section_id ? 'current' : ''; ?>" href="<?php echo admin_url( 'admin.php?page=wc-addons&section=' . esc_attr( $section_id ) ); ?>"><?php echo esc_html( $section->title ); ?></a><?php if ( $section_id !== end( $section_keys ) ) echo ' |'; ?></li>
<?php endforeach; ?>
</ul>
<br class="clear" />
<?php if ( $addons = WC_Admin_Addons::get_section_data( $current_section ) ) : ?>
<ul class="products">
<?php
switch ( $view ) {
case '':
$addons = $addons->popular;
break;
case 'payment-gateways':
$addons = $addons->{'payment-gateways'};
break;
case 'shipping-methods':
$addons = $addons->{'shipping-methods'};
break;
case 'import-export-extensions':
$addons = $addons->{'import-export'};
break;
case 'product-extensions':
$addons = $addons->product;
break;
case 'marketing-extensions':
$addons = $addons->marketing;
break;
case 'accounting-extensions':
$addons = $addons->accounting;
break;
case 'free-extensions':
$addons = $addons->free;
break;
case 'third-party-extensions':
$addons = $addons->{'third-party'};
break;
}
foreach ( $addons as $addon ) {
echo '<li class="product">';
echo '<a href="' . $addon->link . '">';
if ( ! empty( $addon->image ) ) {
echo '<img src="' . $addon->image . '"/>';
} else {
echo '<h3>' . $addon->title . '</h3>';
}
echo '<span class="price">' . $addon->price . '</span>';
echo '<p>' . $addon->excerpt . '</p>';
echo '</a>';
echo '</li>';
}
?>
<?php foreach ( $addons as $addon ) : ?>
<li class="product">
<a href="<?php echo esc_attr( $addon->link ); ?>">
<?php if ( ! empty( $addon->image ) ) : ?>
<img src="<?php echo esc_attr( $addon->image ); ?>"/>
<?php else : ?>
<h3><?php echo esc_html( $addon->title ); ?></h3>
<?php endif; ?>
<span class="price"><?php echo wp_kses_post( $addon->price ); ?></span>
<p><?php echo wp_kses_post( $addon->excerpt ); ?></p>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php else : ?>
<p><?php printf( __( 'Our catalog of WooCommerce Extensions can be found on WooThemes.com here: <a href="%s">WooCommerce Extensions Catalog</a>', 'woocommerce' ), 'http://www.woothemes.com/product-category/woocommerce-extensions/' ); ?></p>
<?php endif; ?>
<?php if ( 'Storefront' != $theme['Name'] ) : ?>
<?php if ( 'Storefront' !== $theme['Name'] ) : ?>
<div class="storefront">
<img src="<?php echo WC()->plugin_url(); ?>/assets/images/storefront.jpg" alt="Storefront" />
<h3><?php _e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h3>
<p>
<?php printf( __( 'We recommend Storefront, the %sofficial%s WooCommerce theme.', 'woocommerce' ), '<em>', '</em>' ); ?>
</p>
<p>
<?php printf( __( 'Storefront is an intuitive &amp; flexible, %sfree%s WordPress theme offering deep integration with WooCommerce and many of the most popular customer-facing extensions.', 'woocommerce' ), '<strong>', '</strong>' ); ?>
</p>
<p><?php printf( __( 'We recommend Storefront, the %sofficial%s WooCommerce theme.', 'woocommerce' ), '<em>', '</em>' ); ?></p>
<p><?php printf( __( 'Storefront is an intuitive &amp; flexible, %sfree%s WordPress theme offering deep integration with WooCommerce and many of the most popular customer-facing extensions.', 'woocommerce' ), '<strong>', '</strong>' ); ?></p>
<p>
<a href="<?php echo esc_url( 'http://www.woothemes.com/storefront/' ); ?>" target="_blank" class="button"><?php _e( 'Read all about it', 'woocommerce' ) ?></a>
<a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-theme&theme=storefront' ), 'install-theme_storefront' ) ); ?>" class="button button-primary"><?php _e( 'Download &amp; install', 'woocommerce' ); ?></a>
</p>
</div>
<?php endif; ?>
</div>

View File

@ -1,6 +1,6 @@
<?php
/**
* Admin View: Page - Status Report
* Admin View: Page - Status Report.
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -72,7 +72,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
if ( $memory < 67108864 ) {
echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: <a href="%s" target="_blank">Increasing memory allocated to PHP</a>', 'woocommerce' ), size_format( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: %s', 'woocommerce' ), size_format( $memory ), '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'woocommerce' ) . '</a>' ) . '</mark>';
} else {
echo '<mark class="yes">' . size_format( $memory ) . '</mark>';
}
@ -106,12 +106,12 @@ if ( ! defined( 'ABSPATH' ) ) {
<td data-export-label="PHP Version"><?php _e( 'PHP Version', 'woocommerce' ); ?>:</td>
<td class="help"><?php echo wc_help_tip( __( 'The version of PHP installed on your hosting server.', 'woocommerce' ) ); ?></td>
<td><?php
// Check if phpversion function exists
// Check if phpversion function exists.
if ( function_exists( 'phpversion' ) ) {
$php_version = phpversion();
if ( version_compare( $php_version, '5.4', '<' ) ) {
echo '<mark class="error">' . sprintf( __( '%s - We recommend a minimum PHP version of 5.4. See: <a href="%s" target="_blank">How to update your PHP version</a>', 'woocommerce' ), esc_html( $php_version ), 'http://docs.woothemes.com/document/how-to-update-your-php-version/' ) . '</mark>';
echo '<mark class="error">' . sprintf( __( '%s - We recommend a minimum PHP version of 5.4. See: %s', 'woocommerce' ), esc_html( $php_version ), '<a href="http://docs.woothemes.com/document/how-to-update-your-php-version/" target="_blank">' . __( 'How to update your PHP version', 'woocommerce' ) . '</a>' ) . '</mark>';
} else {
echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>';
}
@ -124,17 +124,17 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr>
<td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'woocommerce' ); ?>:</td>
<td class="help"><?php echo wc_help_tip( __( 'The largest filesize that can be contained in one post.', 'woocommerce' ) ); ?></td>
<td><?php echo size_format( wc_let_to_num( ini_get('post_max_size') ) ); ?></td>
<td><?php echo size_format( wc_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td>
</tr>
<tr>
<td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'woocommerce' ); ?>:</td>
<td class="help"><?php echo wc_help_tip( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups)', 'woocommerce' ) ); ?></td>
<td><?php echo ini_get('max_execution_time'); ?></td>
<td><?php echo ini_get( 'max_execution_time' ); ?></td>
</tr>
<tr>
<td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'woocommerce' ); ?>:</td>
<td class="help"><?php echo wc_help_tip( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'woocommerce' ) ); ?></td>
<td><?php echo ini_get('max_input_vars'); ?></td>
<td><?php echo ini_get( 'max_input_vars' ); ?></td>
</tr>
<tr>
<td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'woocommerce' ); ?>:</td>
@ -173,7 +173,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php
$posting = array();
// fsockopen/cURL
// fsockopen/cURL.
$posting['fsockopen_curl']['name'] = 'fsockopen/cURL';
$posting['fsockopen_curl']['help'] = wc_help_tip( __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'woocommerce' ) );
@ -181,10 +181,10 @@ if ( ! defined( 'ABSPATH' ) ) {
$posting['fsockopen_curl']['success'] = true;
} else {
$posting['fsockopen_curl']['success'] = false;
$posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce' ). '</mark>';
$posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce' );
}
// SOAP
// SOAP.
$posting['soap_client']['name'] = 'SoapClient';
$posting['soap_client']['help'] = wc_help_tip( __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'woocommerce' ) );
@ -192,10 +192,10 @@ if ( ! defined( 'ABSPATH' ) ) {
$posting['soap_client']['success'] = true;
} else {
$posting['soap_client']['success'] = false;
$posting['soap_client']['note'] = sprintf( __( 'Your server does not have the <a href="%s">SOAP Client</a> class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce' ), 'http://php.net/manual/en/class.soapclient.php' ) . '</mark>';
$posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce' ), '<a href="http://php.net/manual/en/class.soapclient.php">SoapClient</a>' );
}
// DOMDocument
// DOMDocument.
$posting['dom_document']['name'] = 'DOMDocument';
$posting['dom_document']['help'] = wc_help_tip( __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'woocommerce' ) );
@ -203,10 +203,10 @@ if ( ! defined( 'ABSPATH' ) ) {
$posting['dom_document']['success'] = true;
} else {
$posting['dom_document']['success'] = false;
$posting['dom_document']['note'] = sprintf( __( 'Your server does not have the <a href="%s">DOMDocument</a> class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'woocommerce' ), 'http://php.net/manual/en/class.domdocument.php' ) . '</mark>';
$posting['dom_document']['note'] = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'woocommerce' ), '<a href="http://php.net/manual/en/class.domdocument.php">DOMDocument</a>' );
}
// GZIP
// GZIP.
$posting['gzip']['name'] = 'GZip';
$posting['gzip']['help'] = wc_help_tip( __( 'GZip (gzopen) is used to open the GEOIP database from MaxMind.', 'woocommerce' ) );
@ -214,10 +214,21 @@ if ( ! defined( 'ABSPATH' ) ) {
$posting['gzip']['success'] = true;
} else {
$posting['gzip']['success'] = false;
$posting['gzip']['note'] = sprintf( __( 'Your server does not support the <a href="%s">gzopen</a> function - this is required to use the GeoIP database from MaxMind. The API fallback will be used instead for geolocation.', 'woocommerce' ), 'http://php.net/manual/en/zlib.installation.php' ) . '</mark>';
$posting['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is required to use the GeoIP database from MaxMind. The API fallback will be used instead for geolocation.', 'woocommerce' ), '<a href="http://php.net/manual/en/zlib.installation.php">gzopen</a>' );
}
// WP Remote Post Check
// Multibyte String.
$posting['mbstring']['name'] = 'Multibyte String';
$posting['mbstring']['help'] = wc_help_tip( __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'woocommerce' ) );
if ( extension_loaded( 'mbstring' ) ) {
$posting['mbstring']['success'] = true;
} else {
$posting['mbstring']['success'] = false;
$posting['mbstring']['note'] = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'woocommerce' ), '<a href="http://php.net/manual/en/mbstring.installation.php">mbstring</a>' );
}
// WP Remote Post Check.
$posting['wp_remote_post']['name'] = __( 'Remote Post', 'woocommerce');
$posting['wp_remote_post']['help'] = wc_help_tip( __( 'PayPal uses this method of communicating when sending back transaction information.', 'woocommerce' ) );
@ -241,7 +252,7 @@ if ( ! defined( 'ABSPATH' ) ) {
$posting['wp_remote_post']['success'] = false;
}
// WP Remote Get Check
// WP Remote Get Check.
$posting['wp_remote_get']['name'] = __( 'Remote Get', 'woocommerce');
$posting['wp_remote_get']['help'] = wc_help_tip( __( 'WooCommerce plugins may use this method of communication when checking for plugin updates.', 'woocommerce' ) );
@ -341,7 +352,7 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( ! empty( $plugin_data['Name'] ) ) {
// link the plugin name to the plugin url if available
// Link the plugin name to the plugin url if available.
$plugin_name = esc_html( $plugin_data['Name'] );
if ( ! empty( $plugin_data['PluginURI'] ) ) {
@ -493,7 +504,7 @@ if ( ! defined( 'ABSPATH' ) ) {
echo '<tr><td data-export-label="' . esc_attr( $page_name ) . '">' . $page_name . ':</td>';
echo '<td class="help">' . wc_help_tip( $values['help'] ) . '</td><td>';
// Page ID check
// Page ID check.
if ( ! $page_id ) {
echo '<mark class="error">' . __( 'Page not set', 'woocommerce' ) . '</mark>';
$error = true;
@ -732,16 +743,16 @@ if ( ! defined( 'ABSPATH' ) ) {
jQuery( 'tr', jQuery( this ) ).each( function() {
var label = jQuery( this ).find( 'td:eq(0)' ).data( 'export-label' ) || jQuery( this ).find( 'td:eq(0)' ).text();
var the_name = jQuery.trim( label ).replace( /(<([^>]+)>)/ig, '' ); // Remove HTML
var image = jQuery( this ).find( 'td:eq(2)' ).find( 'img' ); // Get WP 4.2 emojis
var prefix = ( undefined === image.attr( 'alt' ) ) ? '' : image.attr( 'alt' ) + ' '; // Remove WP 4.2 emojis
var the_name = jQuery.trim( label ).replace( /(<([^>]+)>)/ig, '' ); // Remove HTML.
var image = jQuery( this ).find( 'td:eq(2)' ).find( 'img' ); // Get WP 4.2 emojis.
var prefix = ( undefined === image.attr( 'alt' ) ) ? '' : image.attr( 'alt' ) + ' '; // Remove WP 4.2 emojis.
var the_value = jQuery.trim( prefix + jQuery( this ).find( 'td:eq(2)' ).text() );
var value_array = the_value.split( ', ' );
if ( value_array.length > 1 ) {
// If value have a list of plugins ','
// Split to add new line
// If value have a list of plugins ','.
// Split to add new line.
var temp_line ='';
jQuery.each( value_array, function( key, line ) {
temp_line = temp_line + line + '\n';

View File

@ -161,6 +161,7 @@ class WC_API_Orders extends WC_API_Resource {
$order_data = array(
'id' => $order->id,
'order_number' => $order->get_order_number(),
'order_key' => $order->order_key,
'created_at' => $this->server->format_datetime( $order_post->post_date_gmt ),
'updated_at' => $this->server->format_datetime( $order_post->post_modified_gmt ),
'completed_at' => $this->server->format_datetime( $order->completed_date, true ),

View File

@ -241,7 +241,7 @@ class WC_API_Products extends WC_API_Resource {
}
/**
* Create a new product
* Create a new product.
*
* @since 2.2
* @param array $data posted data
@ -257,29 +257,29 @@ class WC_API_Products extends WC_API_Resource {
$data = $data['product'];
// Check permissions
// Check permissions.
if ( ! current_user_can( 'publish_products' ) ) {
throw new WC_API_Exception( 'woocommerce_api_user_cannot_create_product', __( 'You do not have permission to create products', 'woocommerce' ), 401 );
}
$data = apply_filters( 'woocommerce_api_create_product_data', $data, $this );
// Check if product title is specified
// Check if product title is specified.
if ( ! isset( $data['title'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_missing_product_title', sprintf( __( 'Missing parameter %s', 'woocommerce' ), 'title' ), 400 );
}
// Check product type
// Check product type.
if ( ! isset( $data['type'] ) ) {
$data['type'] = 'simple';
}
// Set visible visibility when not sent
// Set visible visibility when not sent.
if ( ! isset( $data['catalog_visibility'] ) ) {
$data['catalog_visibility'] = 'visible';
}
// Validate the product type
// Validate the product type.
if ( ! in_array( wc_clean( $data['type'] ), array_keys( wc_get_product_types() ) ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_type', sprintf( __( 'Invalid product type - the product type must be any of these: %s', 'woocommerce' ), implode( ', ', array_keys( wc_get_product_types() ) ) ), 400 );
}
@ -299,44 +299,45 @@ class WC_API_Products extends WC_API_Resource {
$new_product = array(
'post_title' => wc_clean( $data['title'] ),
'post_status' => ( isset( $data['status'] ) ? wc_clean( $data['status'] ) : 'publish' ),
'post_status' => isset( $data['status'] ) ? wc_clean( $data['status'] ) : 'publish',
'post_type' => 'product',
'post_excerpt' => ( isset( $data['short_description'] ) ? $post_excerpt : '' ),
'post_content' => ( isset( $data['description'] ) ? $post_content : '' ),
'post_excerpt' => isset( $data['short_description'] ) ? $post_excerpt : '',
'post_content' => isset( $data['description'] ) ? $post_content : '',
'post_author' => get_current_user_id(),
'menu_order' => isset( $data['menu_order'] ) ? intval( $data['menu_order'] ) : 0,
);
// Attempts to create the new product
// Attempts to create the new product.
$id = wp_insert_post( $new_product, true );
// Checks for an error in the product creation
// Checks for an error in the product creation.
if ( is_wp_error( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_cannot_create_product', $id->get_error_message(), 400 );
}
// Check for featured/gallery images, upload it and set it
// Check for featured/gallery images, upload it and set it.
if ( isset( $data['images'] ) ) {
$this->save_product_images( $id, $data['images'] );
}
// Save product meta fields
// Save product meta fields.
$this->save_product_meta( $id, $data );
// Save variations
// Save variations.
if ( isset( $data['type'] ) && 'variable' == $data['type'] && isset( $data['variations'] ) && is_array( $data['variations'] ) ) {
$this->save_variations( $id, $data );
}
do_action( 'woocommerce_api_create_product', $id, $data );
// Clear cache/transients
// Clear cache/transients.
wc_delete_product_transients( $id );
$this->server->send_status( 201 );
return $this->get_product( $id );
} catch ( WC_API_Exception $e ) {
// Remove the product when fails
// Remove the product when fails.
$this->clear_product( $id );
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
@ -398,20 +399,25 @@ class WC_API_Products extends WC_API_Resource {
wp_update_post( array( 'ID' => $id, 'post_content' => $post_content ) );
}
// Validate the product type
// Menu order.
if ( isset( $data['menu_order'] ) ) {
wp_update_post( array( 'ID' => $id, 'menu_order' => intval( $data['menu_order'] ) ) );
}
// Validate the product type.
if ( isset( $data['type'] ) && ! in_array( wc_clean( $data['type'] ), array_keys( wc_get_product_types() ) ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_type', sprintf( __( 'Invalid product type - the product type must be any of these: %s', 'woocommerce' ), implode( ', ', array_keys( wc_get_product_types() ) ) ), 400 );
}
// Check for featured/gallery images, upload it and set it
// Check for featured/gallery images, upload it and set it.
if ( isset( $data['images'] ) ) {
$this->save_product_images( $id, $data['images'] );
}
// Save product meta fields
// Save product meta fields.
$this->save_product_meta( $id, $data );
// Save variations
// Save variations.
$product = get_product( $id );
if ( $product->is_type( 'variable' ) ) {
if ( isset( $data['variations'] ) && is_array( $data['variations'] ) ) {
@ -424,7 +430,7 @@ class WC_API_Products extends WC_API_Resource {
do_action( 'woocommerce_api_edit_product', $id, $data );
// Clear cache/transients
// Clear cache/transients.
wc_delete_product_transients( $id );
return $this->get_product( $id );
@ -664,9 +670,6 @@ class WC_API_Products extends WC_API_Resource {
$data = wp_parse_args( $data['product_category'], $defaults );
$data = apply_filters( 'woocommerce_api_create_product_category_data', $data, $this );
$name = $data['name'];
unset( $data['name'] );
// Check parent.
$data['parent'] = absint( $data['parent'] );
if ( $data['parent'] ) {
@ -676,28 +679,25 @@ class WC_API_Products extends WC_API_Resource {
}
}
$display_type = $data['display'];
unset( $data['display'] );
// If value of image is numeric, assume value as image_id.
$image = $data['image'];
$image_id = 0;
if ( is_numeric( $image ) ) {
$image_id = absint( $image );
} else if ( ! empty( $image ) ) {
$upload = $this->upload_product_image( esc_url_raw( $image ) );
$image_id = $this->set_product_category_image_as_attachment( $upload );
}
unset( $data['image'] );
$insert = wp_insert_term( $name, 'product_cat', $data );
$insert = wp_insert_term( $data['name'], 'product_cat', $data );
if ( is_wp_error( $insert ) ) {
throw new WC_API_Exception( 'woocommerce_api_cannot_create_product_category', $insert->get_error_message(), 400 );
}
update_woocommerce_term_meta( $insert['term_taxonomy_id'], 'display_type', esc_attr( $display_type ) );
update_woocommerce_term_meta( $insert['term_taxonomy_id'], 'display_type', esc_attr( $data['display'] ) );
// Check if image_id is a valid image attachment before updating the term meta.
if ( wp_attachment_is_image( $image_id ) ) {
if ( $image_id && wp_attachment_is_image( $image_id ) ) {
update_woocommerce_term_meta( $insert['term_taxonomy_id'], 'thumbnail_id', $image_id );
}
@ -743,13 +743,9 @@ class WC_API_Products extends WC_API_Resource {
return $category;
}
$display_type = '';
if ( isset( $data['display'] ) ) {
$display_type = $data['display'];
unset( $data['display'] );
}
if ( isset( $data['image'] ) ) {
$image_id = 0;
// If value of image is numeric, assume value as image_id.
$image = $data['image'];
if ( is_numeric( $image ) ) {
@ -759,13 +755,10 @@ class WC_API_Products extends WC_API_Resource {
$image_id = $this->set_product_category_image_as_attachment( $upload );
}
// In case client supplies invalid image or wants to unset category
// image.
// In case client supplies invalid image or wants to unset category image.
if ( ! wp_attachment_is_image( $image_id ) ) {
$image_id = '';
}
unset( $data['image'] );
}
$update = wp_update_term( $id, 'product_cat', $data );
@ -773,8 +766,8 @@ class WC_API_Products extends WC_API_Resource {
throw new WC_API_Exception( 'woocommerce_api_cannot_edit_product_catgory', __( 'Could not edit the category', 'woocommerce' ), 400 );
}
if ( ! empty( $display_type ) ) {
update_woocommerce_term_meta( $update['term_taxonomy_id'], 'display_type', esc_attr( $display_type ) );
if ( ! empty( $data['display'] ) ) {
update_woocommerce_term_meta( $update['term_taxonomy_id'], 'display_type', sanitize_text_field( $data['display'] ) );
}
if ( isset( $image_id ) ) {
@ -923,10 +916,7 @@ class WC_API_Products extends WC_API_Resource {
$data = wp_parse_args( $data['product_tag'], $defaults );
$data = apply_filters( 'woocommerce_api_create_product_tag_data', $data, $this );
$name = $data['name'];
unset( $data['name'] );
$insert = wp_insert_term( $name, 'product_tag', $data );
$insert = wp_insert_term( $data['name'], 'product_tag', $data );
if ( is_wp_error( $insert ) ) {
throw new WC_API_Exception( 'woocommerce_api_cannot_create_product_tag', $insert->get_error_message(), 400 );
}
@ -1159,6 +1149,7 @@ class WC_API_Products extends WC_API_Resource {
'variations' => array(),
'parent' => array(),
'grouped_products' => array(),
'menu_order' => $product->post->menu_order,
);
}
@ -1247,7 +1238,7 @@ class WC_API_Products extends WC_API_Resource {
}
/**
* Save product meta
* Save product meta.
*
* @since 2.2
* @param int $product_id
@ -1258,7 +1249,7 @@ class WC_API_Products extends WC_API_Resource {
protected function save_product_meta( $product_id, $data ) {
global $wpdb;
// Product Type
// Product Type.
$product_type = null;
if ( isset( $data['type'] ) ) {
$product_type = wc_clean( $data['type'] );
@ -1271,40 +1262,40 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Virtual
// Virtual.
if ( isset( $data['virtual'] ) ) {
update_post_meta( $product_id, '_virtual', ( true === $data['virtual'] ) ? 'yes' : 'no' );
}
// Tax status
// Tax status.
if ( isset( $data['tax_status'] ) ) {
update_post_meta( $product_id, '_tax_status', wc_clean( $data['tax_status'] ) );
}
// Tax Class
// Tax Class.
if ( isset( $data['tax_class'] ) ) {
update_post_meta( $product_id, '_tax_class', wc_clean( $data['tax_class'] ) );
}
// Catalog Visibility
// Catalog Visibility.
if ( isset( $data['catalog_visibility'] ) ) {
update_post_meta( $product_id, '_visibility', wc_clean( $data['catalog_visibility'] ) );
}
// Purchase Note
// Purchase Note.
if ( isset( $data['purchase_note'] ) ) {
update_post_meta( $product_id, '_purchase_note', wc_clean( $data['purchase_note'] ) );
}
// Featured Product
// Featured Product.
if ( isset( $data['featured'] ) ) {
update_post_meta( $product_id, '_featured', ( true === $data['featured'] ) ? 'yes' : 'no' );
}
// Shipping data
// Shipping data.
$this->save_product_shipping_data( $product_id, $data );
// SKU
// SKU.
if ( isset( $data['sku'] ) ) {
$sku = get_post_meta( $product_id, '_sku', true );
$new_sku = wc_clean( $data['sku'] );
@ -1325,7 +1316,7 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Attributes
// Attributes.
if ( isset( $data['attributes'] ) ) {
$attributes = array();
@ -1354,7 +1345,7 @@ class WC_API_Products extends WC_API_Resource {
$options = $attribute['options'];
if ( ! is_array( $attribute['options'] ) ) {
// Text based attributes - Posted values are term names
// Text based attributes - Posted values are term names.
$options = explode( WC_DELIMITER, $options );
}
@ -1364,13 +1355,13 @@ class WC_API_Products extends WC_API_Resource {
$values = array();
}
// Update post terms
// Update post terms.
if ( taxonomy_exists( $taxonomy ) ) {
wp_set_object_terms( $product_id, $values, $taxonomy );
}
if ( $values ) {
// Add attribute to array, but don't set values
// Add attribute to array, but don't set values.
$attributes[ $taxonomy ] = array(
'name' => $taxonomy,
'value' => '',
@ -1382,16 +1373,16 @@ class WC_API_Products extends WC_API_Resource {
}
} elseif ( isset( $attribute['options'] ) ) {
// Array based
// Array based.
if ( is_array( $attribute['options'] ) ) {
$values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', $attribute['options'] ) );
// Text based, separate by pipe
// Text based, separate by pipe.
} else {
$values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', explode( WC_DELIMITER, $attribute['options'] ) ) );
}
// Custom attribute - Add attribute to array and set the values
// Custom attribute - Add attribute to array and set the values.
$attributes[ $attribute_slug ] = array(
'name' => wc_clean( $attribute['name'] ),
'value' => $values,
@ -1417,10 +1408,10 @@ class WC_API_Products extends WC_API_Resource {
update_post_meta( $product_id, '_product_attributes', $attributes );
}
// Sales and prices
// Sales and prices.
if ( in_array( $product_type, array( 'variable', 'grouped' ) ) ) {
// Variable and grouped products have no prices
// Variable and grouped products have no prices.
update_post_meta( $product_id, '_regular_price', '' );
update_post_meta( $product_id, '_sale_price', '' );
update_post_meta( $product_id, '_sale_price_dates_from', '' );
@ -1429,7 +1420,7 @@ class WC_API_Products extends WC_API_Resource {
} else {
// Regular Price
// Regular Price.
if ( isset( $data['regular_price'] ) ) {
$regular_price = ( '' === $data['regular_price'] ) ? '' : wc_format_decimal( $data['regular_price'] );
update_post_meta( $product_id, '_regular_price', $regular_price );
@ -1437,7 +1428,7 @@ class WC_API_Products extends WC_API_Resource {
$regular_price = get_post_meta( $product_id, '_regular_price', true );
}
// Sale Price
// Sale Price.
if ( isset( $data['sale_price'] ) ) {
$sale_price = ( '' === $data['sale_price'] ) ? '' : wc_format_decimal( $data['sale_price'] );
update_post_meta( $product_id, '_sale_price', $sale_price );
@ -1466,7 +1457,7 @@ class WC_API_Products extends WC_API_Resource {
update_post_meta( $product_id, '_sale_price_dates_from', $date_from );
}
// Update price if on sale
// Update price if on sale.
if ( '' !== $sale_price && '' == $date_to && '' == $date_from ) {
update_post_meta( $product_id, '_price', wc_format_decimal( $sale_price ) );
} else {
@ -1484,12 +1475,12 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Product parent ID for groups
// Product parent ID for groups.
if ( isset( $data['parent_id'] ) ) {
wp_update_post( array( 'ID' => $product_id, 'post_parent' => absint( $data['parent_id'] ) ) );
}
// Update parent if grouped so price sorting works and stays in sync with the cheapest child
// Update parent if grouped so price sorting works and stays in sync with the cheapest child.
$_product = wc_get_product( $product_id );
if ( $_product->post->post_parent > 0 || $product_type == 'grouped' ) {
@ -1526,12 +1517,12 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Sold Individually
// Sold Individually.
if ( isset( $data['sold_individually'] ) ) {
update_post_meta( $product_id, '_sold_individually', ( true === $data['sold_individually'] ) ? 'yes' : '' );
}
// Stock status
// Stock status.
if ( isset( $data['in_stock'] ) ) {
$stock_status = ( true === $data['in_stock'] ) ? 'instock' : 'outofstock';
} else {
@ -1542,9 +1533,9 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Stock Data
// Stock Data.
if ( 'yes' == get_option( 'woocommerce_manage_stock' ) ) {
// Manage stock
// Manage stock.
if ( isset( $data['managing_stock'] ) ) {
$managing_stock = ( true === $data['managing_stock'] ) ? 'yes' : 'no';
update_post_meta( $product_id, '_manage_stock', $managing_stock );
@ -1552,7 +1543,7 @@ class WC_API_Products extends WC_API_Resource {
$managing_stock = get_post_meta( $product_id, '_manage_stock', true );
}
// Backorders
// Backorders.
if ( isset( $data['backorders'] ) ) {
if ( 'notify' == $data['backorders'] ) {
$backorders = 'notify';
@ -1586,7 +1577,7 @@ class WC_API_Products extends WC_API_Resource {
wc_update_product_stock_status( $product_id, $stock_status );
// Stock quantity
// Stock quantity.
if ( isset( $data['stock_quantity'] ) ) {
wc_update_product_stock( $product_id, wc_stock_amount( $data['stock_quantity'] ) );
} else if ( isset( $data['inventory_delta'] ) ) {
@ -1597,7 +1588,7 @@ class WC_API_Products extends WC_API_Resource {
}
} else {
// Don't manage stock
// Don't manage stock.
update_post_meta( $product_id, '_manage_stock', 'no' );
update_post_meta( $product_id, '_backorders', $backorders );
update_post_meta( $product_id, '_stock', '' );
@ -1609,7 +1600,7 @@ class WC_API_Products extends WC_API_Resource {
wc_update_product_stock_status( $product_id, $stock_status );
}
// Upsells
// Upsells.
if ( isset( $data['upsell_ids'] ) ) {
$upsells = array();
$ids = $data['upsell_ids'];
@ -1627,7 +1618,7 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Cross sells
// Cross sells.
if ( isset( $data['cross_sell_ids'] ) ) {
$crosssells = array();
$ids = $data['cross_sell_ids'];
@ -1645,19 +1636,19 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Product categories
// Product categories.
if ( isset( $data['categories'] ) && is_array( $data['categories'] ) ) {
$term_ids = array_unique( array_map( 'intval', $data['categories'] ) );
wp_set_object_terms( $product_id, $term_ids, 'product_cat' );
}
// Product tags
// Product tags.
if ( isset( $data['tags'] ) && is_array( $data['tags'] ) ) {
$term_ids = array_unique( array_map( 'intval', $data['tags'] ) );
wp_set_object_terms( $product_id, $term_ids, 'product_tag' );
}
// Downloadable
// Downloadable.
if ( isset( $data['downloadable'] ) ) {
$is_downloadable = ( true === $data['downloadable'] ) ? 'yes' : 'no';
update_post_meta( $product_id, '_downloadable', $is_downloadable );
@ -1665,31 +1656,31 @@ class WC_API_Products extends WC_API_Resource {
$is_downloadable = get_post_meta( $product_id, '_downloadable', true );
}
// Downloadable options
// Downloadable options.
if ( 'yes' == $is_downloadable ) {
// Downloadable files
// Downloadable files.
if ( isset( $data['downloads'] ) && is_array( $data['downloads'] ) ) {
$this->save_downloadable_files( $product_id, $data['downloads'] );
}
// Download limit
// Download limit.
if ( isset( $data['download_limit'] ) ) {
update_post_meta( $product_id, '_download_limit', ( '' === $data['download_limit'] ) ? '' : absint( $data['download_limit'] ) );
}
// Download expiry
// Download expiry.
if ( isset( $data['download_expiry'] ) ) {
update_post_meta( $product_id, '_download_expiry', ( '' === $data['download_expiry'] ) ? '' : absint( $data['download_expiry'] ) );
}
// Download type
// Download type.
if ( isset( $data['download_type'] ) ) {
update_post_meta( $product_id, '_download_type', wc_clean( $data['download_type'] ) );
}
}
// Product url
// Product url.
if ( $product_type == 'external' ) {
if ( isset( $data['product_url'] ) ) {
update_post_meta( $product_id, '_product_url', wc_clean( $data['product_url'] ) );
@ -1700,7 +1691,7 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Reviews allowed
// Reviews allowed.
if ( isset( $data['reviews_allowed'] ) ) {
$reviews_allowed = ( true === $data['reviews_allowed'] ) ? 'open' : 'closed';
@ -2973,8 +2964,8 @@ class WC_API_Products extends WC_API_Resource {
$attribute_term = array(
'id' => $term->term_id,
'slug' => $term->slug,
'name' => $term->name,
'slug' => $term->slug,
'count' => $term->count,
);
@ -3349,9 +3340,6 @@ class WC_API_Products extends WC_API_Resource {
$data = wp_parse_args( $data['product_shipping_class'], $defaults );
$data = apply_filters( 'woocommerce_api_create_product_shipping_class_data', $data, $this );
$name = $data['name'];
unset( $data['name'] );
// Check parent.
$data['parent'] = absint( $data['parent'] );
if ( $data['parent'] ) {
@ -3361,7 +3349,7 @@ class WC_API_Products extends WC_API_Resource {
}
}
$insert = wp_insert_term( $name, 'product_shipping_class', $data );
$insert = wp_insert_term( $data['name'], 'product_shipping_class', $data );
if ( is_wp_error( $insert ) ) {
throw new WC_API_Exception( 'woocommerce_api_cannot_create_product_shipping_class', $insert->get_error_message(), 400 );
}

View File

@ -447,6 +447,7 @@ class WC_API_Server {
'description' => get_option( 'blogdescription' ),
'URL' => get_option( 'siteurl' ),
'wc_version' => WC()->version,
'version' => WC_API::VERSION,
'routes' => array(),
'meta' => array(
'timezone' => wc_timezone_string(),

View File

@ -136,7 +136,7 @@ class WC_API_Taxes extends WC_API_Resource {
}
$tax_data = array(
'id' => $tax['tax_rate_id'],
'id' => (int) $tax['tax_rate_id'],
'country' => $tax['tax_rate_country'],
'state' => $tax['tax_rate_state'],
'postcode' => '',
@ -504,7 +504,7 @@ class WC_API_Taxes extends WC_API_Resource {
}
}
return array( 'taxes' => apply_filters( 'woocommerce_api_taxes_bulk_response', $orders, $this ) );
return array( 'taxes' => apply_filters( 'woocommerce_api_taxes_bulk_response', $taxes, $this ) );
} catch ( WC_API_Exception $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
@ -623,6 +623,8 @@ class WC_API_Taxes extends WC_API_Resource {
* @return array
*/
public function delete_tax_class( $slug ) {
global $wpdb;
try {
// Check permissions
if ( ! current_user_can( 'manage_woocommerce' ) ) {
@ -647,6 +649,19 @@ class WC_API_Taxes extends WC_API_Resource {
update_option( 'woocommerce_tax_classes', implode( "\n", $classes ) );
// Delete tax rate locations locations from the selected class.
$wpdb->query( $wpdb->prepare( "
DELETE locations.*
FROM {$wpdb->prefix}woocommerce_tax_rate_locations AS locations
INNER JOIN
{$wpdb->prefix}woocommerce_tax_rates AS rates
ON rates.tax_rate_id = locations.tax_rate_id
WHERE rates.tax_rate_class = '%s'
", $slug ) );
// Delete tax rates in the selected class.
$wpdb->delete( $wpdb->prefix . 'woocommerce_tax_rates', array( 'tax_rate_class' => $slug ), array( '%s' ) );
return array( 'message' => sprintf( __( 'Deleted %s', 'woocommerce' ), 'tax_class' ) );
} catch ( WC_API_Exception $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );

View File

@ -1753,7 +1753,6 @@ class WC_AJAX {
check_ajax_referer( 'search-products', 'security' );
$term = (string) wc_clean( stripslashes( $_GET['term'] ) );
$exclude = array();
if ( empty( $term ) ) {
die();
@ -1794,6 +1793,14 @@ class WC_AJAX {
$query .= " AND posts.ID NOT IN (" . implode( ',', array_map( 'intval', explode( ',', $_GET['exclude'] ) ) ) . ")";
}
if ( ! empty( $_GET['include'] ) ) {
$query .= " AND posts.ID IN (" . implode( ',', array_map( 'intval', explode( ',', $_GET['include'] ) ) ) . ")";
}
if ( ! empty( $_GET['limit'] ) ) {
$query .= " LIMIT " . intval( $_GET['limit'] );
}
$posts = array_unique( $wpdb->get_col( $query ) );
$found_products = array();
@ -1805,6 +1812,10 @@ class WC_AJAX {
continue;
}
if ( ! $product || ( $product->is_type( 'variation' ) && empty( $product->parent ) ) ) {
continue;
}
$found_products[ $post ] = rawurldecode( $product->get_formatted_name() );
}
}

View File

@ -21,7 +21,7 @@ class WC_API {
/** This is the major version for the REST API and takes
* first-order position in endpoint URLs.
*/
const VERSION = '3.0.0';
const VERSION = '3.1.0';
/** @var WC_API_Server the REST API server */
public $server;

View File

@ -1851,7 +1851,7 @@ class WC_Cart {
foreach ( $this->coupons as $code => $coupon ) {
if ( $coupon->is_valid() && ( $coupon->is_valid_for_product( $product, $values ) || $coupon->is_valid_for_cart() ) ) {
$discount_amount = $coupon->get_discount_amount( ( 'yes' === get_option( 'woocommerce_calc_discounts_sequentially', 'no' ) ? $price : $undiscounted_price ), $values, true );
$discount_amount = $coupon->get_discount_amount( 'yes' === get_option( 'woocommerce_calc_discounts_sequentially', 'no' ) ? $price : $undiscounted_price, $values, true );
$discount_amount = min( $price, $discount_amount );
$price = max( $price - $discount_amount, 0 );
@ -1873,6 +1873,11 @@ class WC_Cart {
$this->increase_coupon_applied_count( $code, $values['quantity'] );
}
}
// If the price is 0, we can stop going through coupons because there is nothing more to discount for this product.
if ( 0 >= $price ) {
break;
}
}
}

View File

@ -643,7 +643,7 @@ class WC_Checkout {
$result = $available_gateways[ $this->posted['payment_method'] ]->process_payment( $order_id );
// Redirect to success/confirmation/payment page
if ( 'success' === $result['result'] ) {
if ( isset( $result['result'] ) && 'success' === $result['result'] ) {
$result = apply_filters( 'woocommerce_payment_successful_result', $result, $order_id );

View File

@ -445,7 +445,7 @@ class WC_Coupon {
* Ensure coupon is valid for sale items in the cart is valid or throw exception.
*/
private function validate_sale_items() {
if ( 'yes' === $this->exclude_sale_items && $this->is_type( array( 'fixed_product', 'percent_product' ) ) ) {
if ( 'yes' === $this->exclude_sale_items && $this->is_type( wc_get_product_coupon_types() ) ) {
$valid_for_cart = false;
$product_ids_on_sale = wc_get_product_ids_on_sale();
@ -470,7 +470,7 @@ class WC_Coupon {
* Cart discounts cannot be added if non-eligble product is found in cart.
*/
private function validate_cart_excluded_items() {
if ( ! $this->is_type( array( 'fixed_product', 'percent_product' ) ) ) {
if ( ! $this->is_type( wc_get_product_coupon_types() ) ) {
$this->validate_cart_excluded_product_ids();
$this->validate_cart_excluded_product_categories();
$this->validate_cart_excluded_sale_items();
@ -578,7 +578,7 @@ class WC_Coupon {
* @return bool
*/
public function is_valid_for_cart() {
return apply_filters( 'woocommerce_coupon_is_valid_for_cart', $this->is_type( array( 'fixed_cart', 'percent' ) ), $this );
return apply_filters( 'woocommerce_coupon_is_valid_for_cart', $this->is_type( wc_get_cart_coupon_types() ), $this );
}
/**
@ -588,7 +588,7 @@ class WC_Coupon {
* @return boolean
*/
public function is_valid_for_product( $product, $values = array() ) {
if ( ! $this->is_type( array( 'fixed_product', 'percent_product' ) ) ) {
if ( ! $this->is_type( wc_get_product_coupon_types() ) ) {
return apply_filters( 'woocommerce_coupon_is_valid_for_product', false, $product, $this, $values );
}

View File

@ -159,7 +159,7 @@ class WC_Frontend_Scripts {
// Chosen is @deprecated as of 2.3 in favour of 2.3. Here for backwards compatibility.
self::register_script( 'chosen', $assets_path . 'js/chosen/chosen.jquery' . $suffix . '.js', array( 'jquery' ), '1.0.0' );
self::register_script( 'select2', $assets_path . 'js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.2' );
self::register_script( 'select2', $assets_path . 'js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.4' );
// Register any scripts for later use, or used as dependencies
self::register_script( 'jquery-blockui', $assets_path . 'js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70' );

View File

@ -26,6 +26,7 @@ class WC_Install {
'2.3.0' => 'updates/woocommerce-update-2.3.php',
'2.4.0' => 'updates/woocommerce-update-2.4.php',
'2.4.1' => 'updates/woocommerce-update-2.4.1.php',
'2.5.0' => 'updates/woocommerce-update-2.5.php',
'2.6.0' => 'updates/woocommerce-update-2.6.php'
);

View File

@ -147,6 +147,7 @@ class WC_Post_types {
'new_item_name' => __( 'New Shipping Class Name', 'woocommerce' )
),
'show_ui' => true,
'show_in_quick_edit' => false,
'show_in_nav_menus' => false,
'query_var' => is_admin(),
'capabilities' => array(
@ -185,6 +186,7 @@ class WC_Post_types {
'new_item_name' => sprintf( __( 'New %s', 'woocommerce' ), $label )
),
'show_ui' => true,
'show_in_quick_edit' => false,
'show_in_menu' => false,
'show_in_nav_menus' => false,
'meta_box_cb' => false,

View File

@ -244,7 +244,7 @@ class WC_Product_Variable extends WC_Product {
* @var string
*/
if ( $display ) {
$price_hash = array( true, WC_Tax::get_rates(), get_option( 'woocommerce_tax_display_shop' ) );
$price_hash = array( get_option( 'woocommerce_tax_display_shop', 'excl' ), WC_Tax::get_rates() );
} else {
$price_hash = array( false );
}
@ -253,7 +253,11 @@ class WC_Product_Variable extends WC_Product {
foreach ( $filter_names as $filter_name ) {
if ( ! empty( $wp_filter[ $filter_name ] ) ) {
$price_hash[ $filter_name ] = $wp_filter[ $filter_name ];
$price_hash[ $filter_name ] = array();
foreach ( $wp_filter[ $filter_name ] as $priority => $callbacks ) {
$price_hash[ $filter_name ][] = array_values( wp_list_pluck( $callbacks, 'function' ) );
}
}
}
@ -265,7 +269,12 @@ class WC_Product_Variable extends WC_Product {
}
// Get value of transient
$this->prices_array = array_filter( (array) get_transient( $transient_name ) );
$this->prices_array = array_filter( (array) json_decode( strval( get_transient( $transient_name ) ), true ) );
// If the product version has changed, reset cache
if ( empty( $this->prices_array['version'] ) || $this->prices_array['version'] !== WC_Cache_Helper::get_transient_version( 'product' ) ) {
$this->prices_array = array( 'version' => WC_Cache_Helper::get_transient_version( 'product' ) );
}
// If the prices are not stored for this hash, generate them
if ( empty( $this->prices_array[ $price_hash ] ) ) {
@ -314,7 +323,7 @@ class WC_Product_Variable extends WC_Product {
'sale_price' => $sale_prices
);
set_transient( $transient_name, $this->prices_array, DAY_IN_SECONDS * 30 );
set_transient( $transient_name, json_encode( $this->prices_array ), DAY_IN_SECONDS * 30 );
}
/**
@ -565,8 +574,8 @@ class WC_Product_Variable extends WC_Product {
$image_link = $full_attachment ? current( $full_attachment ) : '';
$image_title = get_the_title( $attachment_id );
$image_alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
$image_srcset = function_exists( 'wp_get_attachment_image_srcset' ) ? wp_get_attachment_image_srcset( $attachment_id, 'shop_single' ) : '';
$image_sizes = function_exists( 'wp_get_attachment_image_sizes' ) ? wp_get_attachment_image_sizes( $attachment_id, 'shop_single' ) : '';
$image_srcset = function_exists( 'wp_get_attachment_image_srcset' ) ? wp_get_attachment_image_srcset( $attachment_id, 'shop_single' ) : false;
$image_sizes = function_exists( 'wp_get_attachment_image_sizes' ) ? wp_get_attachment_image_sizes( $attachment_id, 'shop_single' ) : false;
} else {
$image = $image_link = $image_title = $image_alt = $image_srcset = $image_sizes = '';
}
@ -587,8 +596,8 @@ class WC_Product_Variable extends WC_Product {
'image_link' => $image_link,
'image_title' => $image_title,
'image_alt' => $image_alt,
'image_srcset' => $image_srcset,
'image_sizes' => $image_sizes,
'image_srcset' => $image_srcset ? $image_srcset : '',
'image_sizes' => $image_sizes ? $image_sizes : '',
'price_html' => apply_filters( 'woocommerce_show_variation_price', $variation->get_price() === "" || $this->get_variation_price( 'min' ) !== $this->get_variation_price( 'max' ), $this, $variation ) ? '<span class="price">' . $variation->get_price_html() . '</span>' : '',
'availability_html' => $availability_html,
'sku' => $variation->get_sku(),
@ -720,8 +729,11 @@ class WC_Product_Variable extends WC_Product {
) );
// No published variations - product won't be purchasable.
if ( ! $children && 'publish' === get_post_status( $product_id ) ) {
if ( is_admin() ) {
if ( ! $children ) {
update_post_meta( $product_id, '_price', '' );
delete_transient( 'wc_products_onsale' );
if ( is_admin() && 'publish' === get_post_status( $product_id ) ) {
WC_Admin_Meta_Boxes::add_error( __( 'This variable product has no active variations. Add or enable variations to allow this product to be purchased.', 'woocommerce' ) );
}

View File

@ -248,11 +248,12 @@ class WC_Query {
}
// Special check for shops with the product archive on front
if ( $q->is_page() && 'page' == get_option( 'show_on_front' ) && $q->get('page_id') == wc_get_page_id('shop') ) {
if ( $q->is_page() && 'page' == get_option( 'show_on_front' ) && $q->get( 'page_id' ) == wc_get_page_id( 'shop' ) ) {
// This is a front-page shop
$q->set( 'post_type', 'product' );
$q->set( 'page_id', '' );
if ( isset( $q->query['paged'] ) ) {
$q->set( 'paged', $q->query['paged'] );
}
@ -264,7 +265,7 @@ class WC_Query {
// This is hacky but works. Awaiting http://core.trac.wordpress.org/ticket/21096
global $wp_post_types;
$shop_page = get_post( wc_get_page_id('shop') );
$shop_page = get_post( wc_get_page_id( 'shop' ) );
$wp_post_types['product']->ID = $shop_page->ID;
$wp_post_types['product']->post_title = $shop_page->post_title;
@ -278,6 +279,9 @@ class WC_Query {
$q->is_archive = true;
$q->is_page = true;
// Remove post type archive name from front page title tag
add_filter( 'post_type_archive_title', '__return_empty_string', 5 );
// Fix WP SEO
if ( class_exists( 'WPSEO_Meta' ) ) {
add_filter( 'wpseo_metadesc', array( $this, 'wpseo_metadesc' ) );
@ -333,10 +337,8 @@ class WC_Query {
*/
public function wpseo_metadesc() {
return WPSEO_Meta::get_value( 'metadesc', wc_get_page_id('shop') );
}
/**
* wpseo_metakey function.
* Hooked into wpseo_ hook already, so no need for function_exist.
@ -348,7 +350,6 @@ class WC_Query {
return WPSEO_Meta::get_value( 'metakey', wc_get_page_id('shop') );
}
/**
* Hook into the_posts to do the main product query if needed - relevanssi compatibility.
*
@ -868,7 +869,7 @@ class WC_Query {
WHERE post_type IN ( 'product', 'product_variation' )
AND post_status = 'publish'
AND pm1.meta_key IN ('" . implode( "','", array_map( 'esc_sql', apply_filters( 'woocommerce_price_filter_meta_keys', array( '_price' ) ) ) ) . "')
AND pm1.meta_value BETWEEN %d AND %d
AND pm1.meta_value BETWEEN %f AND %f
AND pm2.meta_key = '_tax_class'
AND pm2.meta_value = %s
", $min_class, $max_class, sanitize_title( $tax_class ) ), OBJECT_K ), $min_class, $max_class );

View File

@ -84,7 +84,7 @@ class WC_Shortcodes {
private static function product_loop( $query_args, $atts, $loop_name ) {
global $woocommerce_loop;
$products = new WP_Query( apply_filters( 'woocommerce_shortcode_products_query', $query_args, $atts ) );
$products = new WP_Query( apply_filters( 'woocommerce_shortcode_products_query', $query_args, $atts, $loop_name ) );
$columns = absint( $atts['columns'] );
$woocommerce_loop['columns'] = $columns;

View File

@ -442,11 +442,12 @@ class WC_Tax {
// This will be per order shipping - loop through the order and find the highest tax class rate
$cart_tax_classes = WC()->cart->get_cart_item_tax_classes();
// If multiple classes are found, use highest. Don't bother with standard rate, we can get that later.
// If multiple classes are found, use the first one. Don't bother with standard rate, we can get that later.
if ( sizeof( $cart_tax_classes ) > 1 && ! in_array( '', $cart_tax_classes ) ) {
$tax_classes = self::get_tax_classes();
foreach ( $tax_classes as $tax_class ) {
$tax_class = sanitize_title( $tax_class );
if ( in_array( $tax_class, $cart_tax_classes ) ) {
$matched_tax_rates = self::find_shipping_rates( array(
'country' => $country,

View File

@ -601,11 +601,11 @@ class WC_Webhook {
$response_code = wp_remote_retrieve_response_code( $test );
if ( is_wp_error( $test ) ) {
return new WP_Error( 'error', __( 'Error: Delivery URL cannot be reached: ' . $test->get_error_message() ) );
return new WP_Error( 'error', sprintf( __( 'Error: Delivery URL cannot be reached: %s', 'woocommerce' ), $test->get_error_message() ) );
}
if ( 200 !== $response_code ) {
return new WP_Error( 'error', __( 'Error: Delivery URL returned response code ' . absint( $response_code ) ) );
return new WP_Error( 'error', sprintf( __( 'Error: Delivery URL returned response code: %s', 'woocommerce' ), absint( $response_code ) ) );
}
return true;
@ -686,6 +686,7 @@ class WC_Webhook {
}
$wpdb->update( $wpdb->posts, array( 'post_status' => $post_status ), array( 'ID' => $this->id ) );
clean_post_cache( $this->id );
}
/**

View File

@ -389,7 +389,7 @@ class WC_CLI_Coupon extends WC_CLI_Command {
* <coupon>
* : The ID or code of the coupon to update.
*
* --<field>=<value>
* [--<field>=<value>]
* : One or more fields to update.
*
* ## AVAILABLE FIELDS

View File

@ -147,7 +147,7 @@ class WC_CLI_Customer extends WC_CLI_Command {
* ## OPTIONS
*
* <customer>
* : The customer ID, email, or username to delete.
* : The customer ID, email or username.
*
* [--field=<field>]
* : Instead of returning the whole customer fields, returns the value of a single fields.
@ -160,7 +160,9 @@ class WC_CLI_Customer extends WC_CLI_Command {
*
* ## AVAILABLE FIELDS
*
* See
* * download_id
* * download_name
* * access_expires
*
* ## EXAMPLES
*
@ -386,7 +388,7 @@ class WC_CLI_Customer extends WC_CLI_Command {
* ## OPTIONS
*
* <customer>
* : The customer ID, email, or username to delete.
* : The customer ID, email or username.
*
* [--field=<field>]
* : Instead of returning the whole customer fields, returns the value of a single fields.
@ -423,7 +425,7 @@ class WC_CLI_Customer extends WC_CLI_Command {
* <customer>
* : Customer ID, email, or username.
*
* --<field>=<value>
* [--<field>=<value>]
* : One or more fields to update.
*
* ## AVAILABLE FIELDS

View File

@ -27,6 +27,13 @@ class WC_CLI_Order extends WC_CLI_Command {
*
* * customer_id
*
* Optional fields:
*
* * status
* * note
* * currency
* * order_meta
*
* Payment detail fields:
*
* * payment_details.method_id
@ -77,7 +84,7 @@ class WC_CLI_Order extends WC_CLI_Command {
*
* ## EXAMPLES
*
* wp wc order create --customer_id=1 --
* wp wc order create --customer_id=1 --status=pending ...
*
* @since 2.5.0
*/
@ -162,11 +169,6 @@ class WC_CLI_Order extends WC_CLI_Command {
update_post_meta( $order->id, '_order_currency', $data['currency'] );
}
// Set order numberl
if ( isset( $data['order_number'] ) ) {
update_post_meta( $order->id, '_order_number', $data['order_number'] );
}
// Set order meta.
if ( isset( $data['order_meta'] ) && is_array( $data['order_meta'] ) ) {
$this->set_order_meta( $order->id, $data['order_meta'] );
@ -191,7 +193,12 @@ class WC_CLI_Order extends WC_CLI_Command {
}
/**
* Delete an order.
* Delete one or more orders.
*
* ## OPTIONS
*
* <id>...
* : The order ID to delete.
*
* ## EXAMPLES
*
@ -397,14 +404,14 @@ class WC_CLI_Order extends WC_CLI_Command {
* <id>
* : Product ID
*
* --<field>=<value>
* [--<field>=<value>]
* : One or more fields to update.
*
* ## AVAILABLE_FIELDS
* ## AVAILABLE FIELDS
*
* For available fields, see: wp wc order create --help
*
* # EXAMPLES
* ## EXAMPLES
*
* wp wc order update 123 --status=completed
*

View File

@ -27,6 +27,17 @@ class WC_CLI_Product_Category extends WC_CLI_Command {
* [--format=<format>]
* : Accepted values: table, json, csv. Default: table.
*
* ## AVAILABLE FIELDS
*
* * id
* * name
* * slug
* * parent
* * description
* * display
* * image
* * count
*
* ## EXAMPLES
*
* wp wc product category get 123
@ -61,6 +72,17 @@ class WC_CLI_Product_Category extends WC_CLI_Command {
* [--format=<format>]
* : Acceptec values: table, csv, json, count, ids. Default: table.
*
* ## AVAILABLE FIELDS
*
* * id
* * name
* * slug
* * parent
* * description
* * display
* * image
* * count
*
* ## EXAMPLES
*
* wp wc product category list

View File

@ -223,7 +223,7 @@ class WC_CLI_Product extends WC_CLI_Command {
}
/**
* Delete a product.
* Delete products.
*
* ## OPTIONS
*
@ -512,6 +512,15 @@ class WC_CLI_Product extends WC_CLI_Command {
* [--format=<format>]
* : Accepted values: table, json, csv. Default: table.
*
* ## AVAILABLE FIELDS
*
* * id
* * rating
* * reviewer_name
* * reviewer_email
* * verified
* * created_at
*
* ## EXAMPLES
*
* wp wc product reviews 123
@ -578,7 +587,7 @@ class WC_CLI_Product extends WC_CLI_Command {
* <id>
* : Product ID
*
* --<field>=<value>
* [--<field>=<value>]
* : One or more fields to update.
*
* ## AVAILABLE_FIELDS

View File

@ -462,7 +462,7 @@ class WC_CLI_Tax extends WC_CLI_Command {
* <id>
* : The ID of the tax rate to update.
*
* --<field>=<value>
* [--<field>=<value>]
* : One or more fields to update.
*
* ## AVAILABLE FIELDS

View File

@ -62,7 +62,6 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
// Hooks
add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
add_action( 'admin_notices', array( $this, 'checks' ) );
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
add_action( 'woocommerce_receipt_' . $this->id, array( $this, 'receipt_page' ) );
add_action( 'woocommerce_api_wc_gateway_simplify_commerce', array( $this, 'return_handler' ) );
@ -101,6 +100,8 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
<p><?php _e( 'Simplify Commerce is your merchant account and payment gateway all rolled into one. Choose Simplify Commerce as your WooCommerce payment gateway to get access to your money quickly with a powerful, secure payment engine backed by MasterCard.', 'woocommerce' ); ?></p>
<?php endif; ?>
<?php $this->checks(); ?>
<table class="form-table">
<?php $this->generate_settings_html(); ?>
<script type="text/javascript">
@ -120,7 +121,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
jQuery( '#woocommerce_simplify_commerce_mode' ).on( 'change', function() {
var color = jQuery( '#woocommerce_simplify_commerce_modal_color' ).closest( 'tr' );
if ( 'standard' == jQuery( this ).val() ) {
if ( 'standard' === jQuery( this ).val() ) {
color.hide();
} else {
color.show();

View File

@ -0,0 +1,34 @@
<?php
/**
* Update WC to 2.5.0
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin/Updates
* @version 2.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $wpdb;
// Fix currency settings for LAK currency.
$current_currency = get_option( 'woocommerce_currency' );
if ( 'KIP' === $current_currency ) {
update_option( 'woocommerce_currency', 'LAK' );
}
// Update LAK currency code.
$wpdb->update(
$wpdb->postmeta,
array(
'meta_value' => 'LAK'
),
array(
'meta_key' => '_order_currency',
'meta_value' => 'KIP'
)
);

View File

@ -31,7 +31,7 @@ function wc_get_attribute_taxonomies() {
if ( false === ( $attribute_taxonomies = get_transient( 'wc_attribute_taxonomies' ) ) ) {
global $wpdb;
$attribute_taxonomies = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies" );
$attribute_taxonomies = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies order by attribute_name ASC;" );
set_transient( 'wc_attribute_taxonomies', $attribute_taxonomies );
}

View File

@ -164,11 +164,20 @@ function wc_cart_totals_shipping_html() {
foreach ( $packages as $i => $package ) {
$chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : '';
$product_names = array();
if ( sizeof( $packages ) > 1 ) {
foreach ( $package['contents'] as $item_id => $values ) {
$product_names[] = $values['data']->get_title() . ' &times;' . $values['quantity'];
}
}
wc_get_template( 'cart/cart-shipping.php', array(
'package' => $package,
'available_methods' => $package['rates'],
'show_package_details' => sizeof( $packages ) > 1,
'package_details' => implode( ', ', $product_names ),
'package_name' => apply_filters( 'woocommerce_shipping_package_name', sprintf( _n( 'Shipping', 'Shipping %d', ( $i + 1 ), 'woocommerce' ), ( $i + 1 ) ), $i, $package ),
'index' => $i,
'chosen_method' => $chosen_method
) );

View File

@ -136,6 +136,8 @@ function wc_update_order( $args ) {
/**
* Get template part (for templates like the shop-loop).
*
* WC_TEMPLATE_DEBUG_MODE will prevent overrides in themes from taking priority.
*
* @access public
* @param mixed $slug
* @param string $name (default: '')
@ -158,10 +160,8 @@ function wc_get_template_part( $slug, $name = '' ) {
$template = locate_template( array( "{$slug}.php", WC()->template_path() . "{$slug}.php" ) );
}
// Allow 3rd party plugin filter template file from their plugin.
if ( ( ! $template && WC_TEMPLATE_DEBUG_MODE ) || $template ) {
// Allow 3rd party plugins to filter template file from their plugin.
$template = apply_filters( 'wc_get_template_part', $template, $slug, $name );
}
if ( $template ) {
load_template( $template, false );
@ -294,7 +294,8 @@ function get_woocommerce_currencies() {
'INR' => __( 'Indian Rupee', 'woocommerce' ),
'ISK' => __( 'Icelandic krona', 'woocommerce' ),
'JPY' => __( 'Japanese Yen', 'woocommerce' ),
'KIP' => __( 'Lao Kip', 'woocommerce' ),
'KES' => __( 'Kenyan shilling', 'woocommerce' ),
'LAK' => __( 'Lao Kip', 'woocommerce' ),
'KRW' => __( 'South Korean Won', 'woocommerce' ),
'MXN' => __( 'Mexican Peso', 'woocommerce' ),
'MYR' => __( 'Malaysian Ringgits', 'woocommerce' ),
@ -333,134 +334,60 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
$currency = get_woocommerce_currency();
}
switch ( $currency ) {
case 'AED' :
$currency_symbol = 'د.إ';
break;
case 'AUD' :
case 'ARS' :
case 'CAD' :
case 'CLP' :
case 'COP' :
case 'HKD' :
case 'MXN' :
case 'NZD' :
case 'SGD' :
case 'USD' :
$currency_symbol = '&#36;';
break;
case 'BDT':
$currency_symbol = '&#2547;&nbsp;';
break;
case 'BGN' :
$currency_symbol = '&#1083;&#1074;.';
break;
case 'BRL' :
$currency_symbol = '&#82;&#36;';
break;
case 'CHF' :
$currency_symbol = '&#67;&#72;&#70;';
break;
case 'CNY' :
case 'JPY' :
case 'RMB' :
$currency_symbol = '&yen;';
break;
case 'CZK' :
$currency_symbol = '&#75;&#269;';
break;
case 'DKK' :
$currency_symbol = 'DKK';
break;
case 'DOP' :
$currency_symbol = 'RD&#36;';
break;
case 'EGP' :
$currency_symbol = 'EGP';
break;
case 'EUR' :
$currency_symbol = '&euro;';
break;
case 'GBP' :
$currency_symbol = '&pound;';
break;
case 'HRK' :
$currency_symbol = 'Kn';
break;
case 'HUF' :
$currency_symbol = '&#70;&#116;';
break;
case 'IDR' :
$currency_symbol = 'Rp';
break;
case 'ILS' :
$currency_symbol = '&#8362;';
break;
case 'INR' :
$currency_symbol = '&#8377;';
break;
case 'ISK' :
$currency_symbol = 'Kr.';
break;
case 'KIP' :
$currency_symbol = '&#8365;';
break;
case 'KRW' :
$currency_symbol = '&#8361;';
break;
case 'MYR' :
$currency_symbol = '&#82;&#77;';
break;
case 'NGN' :
$currency_symbol = '&#8358;';
break;
case 'NOK' :
$currency_symbol = '&#107;&#114;';
break;
case 'NPR' :
case 'PKR' :
$currency_symbol = '&#8360;';
break;
case 'PHP' :
$currency_symbol = '&#8369;';
break;
case 'PLN' :
$currency_symbol = '&#122;&#322;';
break;
case 'PYG' :
$currency_symbol = '&#8370;';
break;
case 'RON' :
$currency_symbol = 'lei';
break;
case 'RUB' :
$currency_symbol = '&#1088;&#1091;&#1073;.';
break;
case 'SEK' :
$currency_symbol = '&#107;&#114;';
break;
case 'THB' :
$currency_symbol = '&#3647;';
break;
case 'TRY' :
$currency_symbol = '&#8378;';
break;
case 'TWD' :
$currency_symbol = '&#78;&#84;&#36;';
break;
case 'UAH' :
$currency_symbol = '&#8372;';
break;
case 'VND' :
$currency_symbol = '&#8363;';
break;
case 'ZAR' :
$currency_symbol = '&#82;';
break;
default :
$currency_symbol = '';
break;
}
$symbols = apply_filters( 'woocommerce_currency_symbols', array(
'AED' => 'د.إ',
'ARS' => '&#36;',
'AUD' => '&#36;',
'BDT' => '&#2547;&nbsp;',
'BGN' => '&#1083;&#1074;.',
'BRL' => '&#82;&#36;',
'CAD' => '&#36;',
'CHF' => '&#67;&#72;&#70;',
'CLP' => '&#36;',
'CNY' => '&yen;',
'COP' => '&#36;',
'CZK' => '&#75;&#269;',
'DKK' => 'DKK',
'DOP' => 'RD&#36;',
'EGP' => 'EGP',
'EUR' => '&euro;',
'GBP' => '&pound;',
'HKD' => '&#36;',
'HRK' => 'Kn',
'HUF' => '&#70;&#116;',
'IDR' => 'Rp',
'ILS' => '&#8362;',
'INR' => '&#8377;',
'ISK' => 'Kr.',
'JPY' => '&yen;',
'KES' => 'KSh',
'LAK' => '&#8365;',
'KRW' => '&#8361;',
'MXN' => '&#36;',
'MYR' => '&#82;&#77;',
'NGN' => '&#8358;',
'NOK' => '&#107;&#114;',
'NPR' => '&#8360;',
'NZD' => '&#36;',
'PHP' => '&#8369;',
'PKR' => '&#8360;',
'PLN' => '&#122;&#322;',
'PYG' => '&#8370;',
'RMB' => '&yen;',
'RON' => 'lei',
'RUB' => '&#1088;&#1091;&#1073;.',
'SEK' => '&#107;&#114;',
'SGD' => '&#36;',
'THB' => '&#3647;',
'TRY' => '&#8378;',
'TWD' => '&#78;&#84;&#36;',
'UAH' => '&#8372;',
'USD' => '&#36;',
'VND' => '&#8363;',
'ZAR' => '&#82;',
) );
$currency_symbol = isset( $symbols[ $currency ] ) ? $symbols[ $currency ] : '';
return apply_filters( 'woocommerce_currency_symbol', $currency_symbol, $currency );
}

View File

@ -36,10 +36,27 @@ function wc_get_coupon_types() {
*/
function wc_get_coupon_type( $type = '' ) {
$types = wc_get_coupon_types();
if ( isset( $types[ $type ] ) )
return $types[ $type ];
return isset( $types[ $type ] ) ? $types[ $type ] : '';
}
return '';
/**
* Coupon types that apply to individual products. Controls which validation rules will apply.
*
* @since 2.5.0
* @return bool
*/
function wc_get_product_coupon_types() {
return (array) apply_filters( 'woocommerce_product_coupon_types', array( 'fixed_product', 'percent_product' ) );
}
/**
* Coupon types that apply to the cart as a whole. Controls which validation rules will apply.
*
* @since 2.5.0
* @return bool
*/
function wc_get_cart_coupon_types() {
return (array) apply_filters( 'woocommerce_cart_coupon_types', array( 'fixed_cart', 'percent' ) );
}
/**
@ -51,5 +68,5 @@ function wc_get_coupon_type( $type = '' ) {
* @return bool
*/
function wc_coupons_enabled() {
return apply_filters( 'woocommerce_coupons_enabled', 'yes' == get_option( 'woocommerce_enable_coupons' ) );
return apply_filters( 'woocommerce_coupons_enabled', 'yes' === get_option( 'woocommerce_enable_coupons' ) );
}

View File

@ -51,6 +51,10 @@ function wc_is_order_status( $maybe_status ) {
* @return WC_Order
*/
function wc_get_order( $the_order = false ) {
if ( ! did_action( 'woocommerce_init' ) ) {
_doing_it_wrong( __FUNCTION__, __( 'wc_get_order should not be called before the woocommerce_init action.', 'woocommerce' ), '2.5' );
return false;
}
return WC()->order_factory->get_order( $the_order );
}

View File

@ -22,6 +22,10 @@ if ( ! defined( 'ABSPATH' ) ) {
* @return WC_Product
*/
function wc_get_product( $the_product = false, $args = array() ) {
if ( ! did_action( 'woocommerce_init' ) ) {
_doing_it_wrong( __FUNCTION__, __( 'wc_get_product should not be called before the woocommerce_init action.', 'woocommerce' ), '2.5' );
return false;
}
return WC()->product_factory->get_product( $the_product, $args );
}

View File

@ -1808,23 +1808,12 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
break;
case 'password' :
$field .= '<input type="password" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
break;
case 'text' :
$field .= '<input type="text" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" '.$args['maxlength'].' value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
break;
case 'email' :
$field .= '<input type="email" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" '.$args['maxlength'].' value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
break;
case 'tel' :
case 'number' :
$field .= '<input type="tel" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" '.$args['maxlength'].' value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
$field .= '<input type="' . esc_attr( $args['type'] ) . '" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" ' . $args['maxlength'] . ' value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
break;
case 'select' :

View File

@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
/**
* Layered Navigation Fitlers Widget.
* Layered Navigation Filters Widget.
*
* @author WooThemes
* @category Widgets

View File

@ -2,8 +2,8 @@
Contributors: automattic, mikejolley, jameskoster, claudiosanches, royho, woothemes
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, affiliate, store, sales, sell, shop, shopping, cart, checkout, configurable, variable, widgets, reports, download, downloadable, digital, inventory, stock, reports, shipping, tax
Requires at least: 4.1
Tested up to: 4.3
Stable tag: 2.4.9
Tested up to: 4.4
Stable tag: 2.4.12
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -139,7 +139,7 @@ You can vote on and request new features and extensions in our [WooIdeas board](
Bugs can be reported either in our support forum or preferably on the [WooCommerce GitHub repository](https://github.com/woothemes/woocommerce/issues).
= Where can I found the Rest API documentation? =
= Where can I find the REST API documentation? =
You can find the documentation of our REST API on the [WooCommerce REST API Docs](http://woothemes.github.io/woocommerce-rest-api-docs/).
@ -193,6 +193,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Tweak - Improved review verification status retrieval.
* Tweak - Improve appearance when only 1 gateway is active.
* Tweak - Aligned terms box left and added required asterisk.
* Tweak - Removed dropdown display mode for cart shipping methods - radios are more flexible.
* Dev - API - Added /products/shipping_classes endpoint.
* Dev - API - Added support to POST, PUT, and DELETE categories and tags.
* Dev - API - Added support to filter products by tag, category, shipping class, and attribute.
@ -208,6 +209,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Dev - Added a manual update trigger for checkout.
* Dev - Added woocommerce_is_price_filter_active filter to Query class.
* Dev - Replaced some cart methods with dedicated functions. e.g. wc_ship_to_billing_address_only().
* Localisation - Add Kenyan currency and symbol.
[See changelog for all versions](https://raw.githubusercontent.com/woothemes/woocommerce/master/CHANGELOG.txt).

View File

@ -21,62 +21,36 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
<tr class="shipping">
<th><?php
if ( $show_package_details && $index ) {
$shipping_name = sprintf( __( 'Shipping #%d', 'woocommerce' ), $index + 1 );
} else {
$shipping_name = __( 'Shipping', 'woocommerce' );
}
echo wp_kses_post( apply_filters( 'woocommerce_shipping_package_name', $shipping_name, $index, $package ) );
?></th>
<td data-title="<?php echo wp_kses_post( apply_filters( 'woocommerce_shipping_package_name', $shipping_name, $index, $package ) ); ?>">
<?php if ( empty( $available_methods ) ) : ?>
<?php if ( ( WC()->countries->get_states( WC()->customer->get_shipping_country() ) && ! WC()->customer->get_shipping_state() ) || ! WC()->customer->get_shipping_postcode() ) : ?>
<?php echo wpautop( __( 'Shipping costs will be calculated once you have provided your address.', 'woocommerce' ) ); ?>
<?php else : ?>
<?php echo apply_filters( is_cart() ? 'woocommerce_cart_no_shipping_available_html' : 'woocommerce_no_shipping_available_html', wpautop( __( 'There are no shipping methods available. Please double check your address, or contact us if you need any help.', 'woocommerce' ) ) ); ?>
<?php endif; ?>
<?php elseif ( 1 === count( $available_methods ) ) : ?>
<?php $method = current( $available_methods ); ?>
<?php echo wc_cart_totals_shipping_method_label( $method ); ?>
<input type="hidden" name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>" value="<?php echo esc_attr( $method->id ); ?>" class="shipping_method" />
<?php elseif ( 'select' === get_option( 'woocommerce_shipping_method_format' ) ) : ?>
<select name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>" class="shipping_method">
<?php foreach ( $available_methods as $method ) : ?>
<option value="<?php echo esc_attr( $method->id ); ?>" <?php selected( $method->id, $chosen_method ); ?>><?php echo wc_cart_totals_shipping_method_label( $method ); ?></option>
<?php endforeach; ?>
</select>
<?php else : ?>
<th><?php echo wp_kses_post( $package_name ); ?></th>
<td data-title="<?php echo esc_attr( $package_name ); ?>">
<?php if ( 1 < count( $available_methods ) ) : ?>
<ul id="shipping_method">
<?php foreach ( $available_methods as $method ) : ?>
<li>
<input type="radio" name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>" value="<?php echo esc_attr( $method->id ); ?>" <?php checked( $method->id, $chosen_method ); ?> class="shipping_method" />
<label for="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>"><?php echo wc_cart_totals_shipping_method_label( $method ); ?></label>
<?php
printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />
<label for="shipping_method_%1$d_%2$s">%5$s</label>',
$index, sanitize_title( $method->id ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ), wc_cart_totals_shipping_method_label( $method ) );
do_action( 'woocommerce_after_shipping_rate', $method, $index );
?>
</li>
<?php endforeach; ?>
</ul>
<?php elseif ( 1 === count( $available_methods ) ) : ?>
<?php
$method = current( $available_methods );
printf( '%3$s <input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d" value="%2$s" class="shipping_method" />', $index, esc_attr( $method->id ), wc_cart_totals_shipping_method_label( $method ) );
do_action( 'woocommerce_after_shipping_rate', $method, $index );
?>
<?php elseif ( ! WC()->customer->has_calculated_shipping() ) : ?>
<?php echo wpautop( __( 'Shipping costs will be calculated once you have provided your address.', 'woocommerce' ) ); ?>
<?php else : ?>
<?php echo apply_filters( is_cart() ? 'woocommerce_cart_no_shipping_available_html' : 'woocommerce_no_shipping_available_html', wpautop( __( 'There are no shipping methods available. Please double check your address, or contact us if you need any help.', 'woocommerce' ) ) ); ?>
<?php endif; ?>
<?php if ( $show_package_details ) : ?>
<?php
foreach ( $package['contents'] as $item_id => $values ) {
$product_names[] = $values['data']->get_title() . ' &times;' . $values['quantity'];
}
echo '<p class="woocommerce-shipping-contents"><small>' . __( 'Shipping', 'woocommerce' ) . ': ' . implode( ', ', $product_names ) . '</small></p>';
?>
<?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
<?php endif; ?>
<?php if ( is_cart() && ! $index ) : ?>

View File

@ -31,7 +31,7 @@ wc_print_notice( $info_message, 'notice' );
<?php
woocommerce_login_form(
array(
'message' => __( 'If you have shopped with us before, please enter your details in the boxes below. If you are a new customer please proceed to the Billing &amp; Shipping section.', 'woocommerce' ),
'message' => __( 'If you have shopped with us before, please enter your details in the boxes below. If you are a new customer, please proceed to the Billing &amp; Shipping section.', 'woocommerce' ),
'redirect' => wc_get_page_permalink( 'checkout' ),
'hidden' => true
)

View File

@ -73,14 +73,14 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="form-row">
<input type="hidden" name="woocommerce_pay" value="1" />
<?php wc_get_template( 'checkout/terms.php' ); ?>
<?php do_action( 'woocommerce_pay_order_before_submit' ); ?>
<?php echo apply_filters( 'woocommerce_pay_order_button_html', '<input type="submit" class="button alt" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?>
<?php do_action( 'woocommerce_pay_order_after_submit' ); ?>
<?php wc_get_template( 'checkout/terms.php' ); ?>
<?php wp_nonce_field( 'woocommerce-pay' ); ?>
</div>
</div>

View File

@ -42,14 +42,14 @@ if ( ! is_ajax() ) {
<br/><input type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php esc_attr_e( 'Update totals', 'woocommerce' ); ?>" />
</noscript>
<?php wc_get_template( 'checkout/terms.php' ); ?>
<?php do_action( 'woocommerce_review_order_before_submit' ); ?>
<?php echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?>
<?php do_action( 'woocommerce_review_order_after_submit' ); ?>
<?php wc_get_template( 'checkout/terms.php' ); ?>
<?php wp_nonce_field( 'woocommerce-process_checkout' ); ?>
</div>
</div>

View File

@ -16,7 +16,7 @@ if [ $1 == 'before' ]; then
[ $TRAVIS_PHP_VERSION == '5.2' ] && exit;
# install php-coveralls to send coverage info
composer init --require=satooshi/php-coveralls:0.7.x-dev -n
composer init --require=satooshi/php-coveralls:0.7.0 -n
composer install --no-interaction
elif [ $1 == 'after' ]; then

View File

@ -52,7 +52,8 @@ class Core_Functions extends \WC_Unit_Test_Case {
'INR' => __( 'Indian Rupee', 'woocommerce' ),
'ISK' => __( 'Icelandic krona', 'woocommerce' ),
'JPY' => __( 'Japanese Yen', 'woocommerce' ),
'KIP' => __( 'Lao Kip', 'woocommerce' ),
'KES' => __( 'Kenyan shilling', 'woocommerce' ),
'LAK' => __( 'Lao Kip', 'woocommerce' ),
'KRW' => __( 'South Korean Won', 'woocommerce' ),
'MXN' => __( 'Mexican Peso', 'woocommerce' ),
'MYR' => __( 'Malaysian Ringgits', 'woocommerce' ),

View File

@ -3,7 +3,7 @@
* Plugin Name: WooCommerce
* Plugin URI: http://www.woothemes.com/woocommerce/
* Description: An e-commerce toolkit that helps you sell anything. Beautifully.
* Version: 2.5.0-beta-1
* Version: 2.5.0-beta-3
* Author: WooThemes
* Author URI: http://woothemes.com
* Requires at least: 4.1