Merge branch 'master' into feature/16445

This commit is contained in:
Claudio Sanches 2017-08-17 13:32:47 -03:00
commit fad774267c
13 changed files with 23 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -567,6 +567,10 @@ button.pswp__button--zoom:hover {
background-position: -88px 0;
}
.pswp img {
max-width: none;
}
/**
* Widgets
*/

View File

@ -272,7 +272,7 @@ jQuery( function( $ ) {
$( document ).on(
'wc_update_cart',
this.update_cart );
function() { cart.update_cart.apply( cart, [].slice.call( arguments, 1 ) ); } );
$( document ).on(
'click',
'.woocommerce-cart-form input[type=submit]',

View File

@ -909,8 +909,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$item->set_amount( trim( $discount, '%' ) );
$item->set_discount_type( 'percent' );
$this->add_item( $item );
} elseif ( is_numeric( $discount ) && 0 < absint( $discount ) ) {
$item->set_amount( absint( $discount ) );
} elseif ( is_numeric( $discount ) && 0 < floatval( $discount ) ) {
$item->set_amount( floatval( $discount ) );
$item->set_discount_type( 'fixed' );
$this->add_item( $item );
}

View File

@ -263,7 +263,7 @@ $pages = $system_status->get_pages();
if ( $environment['remote_post_successful'] ) {
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
} else {
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'wp_remote_post() failed. Contact your hosting provider.', 'woocommerce' ) . ' ' . esc_html( $environment['remote_post_response'] ) . '</mark>';
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s failed. Contact your hosting provider.', 'woocommerce' ), 'wp_remote_post()' ) . ' ' . esc_html( $environment['remote_post_response'] ) . '</mark>';
} ?>
</td>
</tr>
@ -274,7 +274,7 @@ $pages = $system_status->get_pages();
if ( $environment['remote_get_successful'] ) {
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
} else {
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'wp_remote_get() failed. Contact your hosting provider.', 'woocommerce' ) . ' ' . esc_html( $environment['remote_get_response'] ) . '</mark>';
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s failed. Contact your hosting provider.', 'woocommerce' ), 'wp_remote_get()' ) . ' ' . esc_html( $environment['remote_get_response'] ) . '</mark>';
} ?>
</td>
</tr>

View File

@ -155,7 +155,7 @@ class WC_Breadcrumb {
} else {
$cat = current( get_the_category( $post ) );
if ( $cat ) {
$this->term_ancestors( $cat->term_id, 'post_category' );
$this->term_ancestors( $cat->term_id, 'category' );
$this->add_crumb( $cat->name, get_term_link( $cat ) );
}
}
@ -247,8 +247,7 @@ class WC_Breadcrumb {
$this_category = get_category( $GLOBALS['wp_query']->get_queried_object() );
if ( 0 != $this_category->parent ) {
$this->term_ancestors( $this_category->parent, 'post_category' );
$this->add_crumb( $this_category->name, get_category_link( $this_category->term_id ) );
$this->term_ancestors( $this_category->term_id, 'category' );
}
$this->add_crumb( single_cat_title( '', false ), get_category_link( $this_category->term_id ) );

View File

@ -295,9 +295,9 @@ class WC_Discounts {
if ( strstr( $raw_discount, '%' ) ) {
$discount->set_discount_type( 'percent' );
$discount->set_amount( trim( $raw_discount, '%' ) );
} elseif ( is_numeric( $raw_discount ) && 0 < absint( $raw_discount ) ) {
} elseif ( is_numeric( $raw_discount ) && 0 < floatval( $raw_discount ) ) {
$discount->set_discount_type( 'fixed' );
$discount->set_amount( wc_add_number_precision( absint( $raw_discount ) ) );
$discount->set_amount( wc_add_number_precision( floatval( $raw_discount ) ) );
}
if ( ! $discount->get_amount() ) {

View File

@ -126,7 +126,8 @@ class WC_Logger implements WC_Logger_Interface {
*/
public function log( $level, $message, $context = array() ) {
if ( ! WC_Log_Levels::is_valid_level( $level ) ) {
wc_doing_it_wrong( __METHOD__, sprintf( __( 'WC_Logger::log was called with an invalid level "%s".', 'woocommerce' ), $level ), '3.0' );
/* translators: 1: WC_Logger::log 2: level */
wc_doing_it_wrong( __METHOD__, sprintf( __( '%1$s was called with an invalid level "%2$s".', 'woocommerce' ), '<code>WC_Logger::log</code>', $level ), '3.0' );
}
if ( $this->should_handle( $level ) ) {

View File

@ -131,7 +131,7 @@ class WC_Shipping {
$this->shipping_methods = $shipping_zone->get_shipping_methods( true );
// Debug output
if ( $debug_mode && ! defined( 'WOOCOMMERCE_CHECKOUT' ) && ! wc_has_notice( 'Customer matched zone "' . $shipping_zone->get_zone_name() . '"' ) ) {
if ( $debug_mode && ! defined( 'WOOCOMMERCE_CHECKOUT' ) && ! defined( 'WC_DOING_AJAX' ) && ! wc_has_notice( 'Customer matched zone "' . $shipping_zone->get_zone_name() . '"' ) ) {
wc_add_notice( 'Customer matched zone "' . $shipping_zone->get_zone_name() . '"' );
}
} else {

View File

@ -27,7 +27,7 @@ abstract class WP_REST_Controller {
* Register the routes for the objects of the controller.
*/
public function register_routes() {
wc_doing_it_wrong( 'WP_REST_Controller::register_routes', __( 'The register_routes() method must be overridden', 'woocommerce' ), 'WPAPI-2.0' );
wc_doing_it_wrong( 'WP_REST_Controller::register_routes', sprintf( __( "Method '%s' must be overridden.", 'woocommerce' ), 'register_routes()' ), 'WPAPI-2.0' );
}
/**

View File

@ -58,7 +58,8 @@ function wc_get_products( $args ) {
*/
function wc_get_product( $the_product = false, $deprecated = array() ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'wc_get_product should not be called before the woocommerce_init action.', 'woocommerce' ), '2.5' );
/* translators: 1: wc_get_product 2: woocommerce_init */
wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%1$s should not be called before the %2$s action.', 'woocommerce' ), 'wc_get_product', 'woocommerce_init' ), '2.5' );
return false;
}
if ( ! empty( $deprecated ) ) {

View File

@ -223,11 +223,10 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
$this->assertEquals( 200, $response->get_status() );
$this->assertEquals( count( $raw_tools ), count( $data ) );
$this->assertContains( array(
'id' => 'reset_tracking',
'name' => 'Reset usage tracking settings',
'action' => 'Reset usage tracking settings',
'name' => 'Reset usage tracking',
'action' => 'Reset',
'description' => 'This will reset your usage tracking settings, causing it to show the opt-in banner again and not sending any data.',
'_links' => array(
'item' => array(