Merge remote-tracking branch 'woocommerce/master'

This commit is contained in:
Job 2017-03-30 16:28:22 +02:00
commit 7bc9de63ad
8 changed files with 46 additions and 17 deletions

View File

@ -384,7 +384,7 @@ class WC_Admin_Attributes {
<div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg( 'edit', $tax->attribute_id, 'edit.php?post_type=product&amp;page=product_attributes' ) ); ?>"><?php _e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'delete', $tax->attribute_id, 'edit.php?post_type=product&amp;page=product_attributes' ), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php _e( 'Delete', 'woocommerce' ); ?></a></span></div>
</td>
<td><?php echo esc_html( $tax->attribute_name ); ?></td>
<td><?php echo esc_html( ucfirst( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? __( '(Public)', 'woocommerce' ) : ''; ?></td>
<td><?php echo esc_html( wc_get_attribute_type_label( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? __( '(Public)', 'woocommerce' ) : ''; ?></td>
<td><?php
switch ( $tax->attribute_orderby ) {
case 'name' :

View File

@ -38,8 +38,8 @@ class WC_Admin_Menus {
add_filter( 'menu_order', array( $this, 'menu_order' ) );
add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) );
// Add endpoints custom URLs in Appearance > Menus > Pages
add_action( 'admin_init', array( $this, 'add_nav_menu_meta_boxes' ) );
// Add endpoints custom URLs in Appearance > Menus > Pages.
add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) );
// Admin bar menus
if ( apply_filters( 'woocommerce_show_admin_bar_visit_store', true ) ) {
@ -238,30 +238,39 @@ class WC_Admin_Menus {
* Output menu links.
*/
public function nav_menu_links() {
$exclude = array( 'view-order', 'add-payment-method', 'order-pay', 'order-received' );
// Get items from account menu.
$endpoints = wc_get_account_menu_items();
// Remove dashboard item.
if ( isset( $endpoints['dashboard'] ) ) {
unset( $endpoints['dashboard'] );
}
// Include missing lost password.
$endpoints['lost-password'] = __( 'Lost password', 'woocommerce' );
$endpoints = apply_filters( 'woocommerce_custom_nav_menu_items', $endpoints );
?>
<div id="posttype-woocommerce-endpoints" class="posttypediv">
<div id="tabs-panel-woocommerce-endpoints" class="tabs-panel tabs-panel-active">
<ul id="woocommerce-endpoints-checklist" class="categorychecklist form-no-clear">
<?php
$i = -1;
foreach ( WC()->query->query_vars as $key => $value ) {
if ( in_array( $key, $exclude ) ) {
continue;
}
foreach ( $endpoints as $key => $value ) :
?>
<li>
<label class="menu-item-title">
<input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-object-id]" value="<?php echo esc_attr( $i ); ?>" /> <?php echo esc_html( $key ); ?>
<input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-object-id]" value="<?php echo esc_attr( $i ); ?>" /> <?php echo esc_html( $value ); ?>
</label>
<input type="hidden" class="menu-item-type" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-type]" value="custom" />
<input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-title]" value="<?php echo esc_html( $key ); ?>" />
<input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-url]" value="<?php echo esc_url( wc_get_endpoint_url( $key, '', wc_get_page_permalink( 'myaccount' ) ) ); ?>" />
<input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-title]" value="<?php echo esc_html( $value ); ?>" />
<input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-url]" value="<?php echo esc_url( wc_get_account_endpoint_url( $key ) ); ?>" />
<input type="hidden" class="menu-item-classes" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-classes]" />
</li>
<?php
$i --;
}
$i--;
endforeach;
?>
</ul>
</div>

View File

@ -44,7 +44,7 @@
<label for="_sale_price_dates_from">' . __( 'Sale price dates', 'woocommerce' ) . '</label>
<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . _x( 'From&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . _x( 'To&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
<a href="#" class="cancel_sale_schedule">' . __( 'Cancel', 'woocommerce' ) . '</a>' . wc_help_tip( __( 'The sale will end at the beginning of the set date.', 'woocommerce' ) ) . '
<a href="#" class="description cancel_sale_schedule">' . __( 'Cancel', 'woocommerce' ) . '</a>' . wc_help_tip( __( 'The sale will end at the beginning of the set date.', 'woocommerce' ) ) . '
</p>';
do_action( 'woocommerce_product_options_pricing' );

View File

@ -1372,7 +1372,7 @@ class WC_AJAX {
$line_items[ $item_id ]['refund_total'] = wc_format_decimal( $total );
}
foreach ( $line_item_tax_totals as $item_id => $tax_totals ) {
$line_items[ $item_id ]['refund_tax'] = array_map( 'wc_format_decimal', $tax_totals );
$line_items[ $item_id ]['refund_tax'] = array_filter( array_map( 'wc_format_decimal', $tax_totals ) );
}
// Create the refund object.

View File

@ -519,7 +519,7 @@ class WC_Checkout {
* Get posted data from the checkout form.
*
* @since 3.0.0
* @return array of data and errors.
* @return array of data.
*/
protected function get_posted_data() {
$skipped = array();

View File

@ -205,6 +205,11 @@ class WC_Comments {
return;
}
add_comment_meta( $comment_id, 'rating', (int) esc_attr( $_POST['rating'] ), true );
$post_id = isset( $_POST['comment_post_ID'] ) ? (int) $_POST['comment_post_ID'] : 0;
if ( $post_id ) {
self::clear_transients( $post_id );
}
}
}

View File

@ -100,6 +100,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
'menu_order' => $product->get_menu_order(),
'post_date' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getOffsetTimestamp() ),
'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getTimestamp() ),
'post_name' => $product->get_slug( 'edit' ),
) ), true );
if ( $id && ! is_wp_error( $id ) ) {
@ -164,7 +165,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
$changes = $product->get_changes();
// Only update the post when the post data changes.
if ( array_intersect( array( 'description', 'short_description', 'name', 'parent_id', 'reviews_allowed', 'status', 'menu_order', 'date_created', 'date_modified' ), array_keys( $changes ) ) ) {
if ( array_intersect( array( 'description', 'short_description', 'name', 'parent_id', 'reviews_allowed', 'status', 'menu_order', 'date_created', 'date_modified', 'slug' ), array_keys( $changes ) ) ) {
wp_update_post( array(
'ID' => $product->get_id(),
'post_content' => $product->get_description( 'edit' ),
@ -178,6 +179,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $product->get_date_created( 'edit' )->getTimestamp() ),
'post_modified' => isset( $changes['date_modified'] ) ? gmdate( 'Y-m-d H:i:s', $product->get_date_modified( 'edit' )->getOffsetTimestamp() ) : current_time( 'mysql' ),
'post_modified_gmt' => isset( $changes['date_modified'] ) ? gmdate( 'Y-m-d H:i:s', $product->get_date_modified( 'edit' )->getTimestamp() ) : current_time( 'mysql', 1 ),
'post_name' => $product->get_slug( 'edit' ),
) );
}

View File

@ -197,6 +197,19 @@ function wc_get_attribute_types() {
) );
}
/**
* Get attribute type label.
*
* @since 3.0.0
* @param string $type Attribute type slug.
* @return string
*/
function wc_get_attribute_type_label( $type ) {
$types = wc_get_attribute_types();
return isset( $types[ $type ] ) ? $types[ $type ] : ucfirst( $type );
}
/**
* Check if attribute name is reserved.
* https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms.