From ba0b4196fa70729a7132f4b9bced5036a80a294e Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 15 Apr 2013 13:15:42 +0100 Subject: [PATCH] Posted 'text' terms are not slugs. Only striptags/slashes - don't change to slugs. Closes #2955. --- admin/post-types/writepanels/writepanel-product_data.php | 7 ++++--- readme.txt | 2 ++ woocommerce-ajax.php | 9 +++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/admin/post-types/writepanels/writepanel-product_data.php b/admin/post-types/writepanels/writepanel-product_data.php index be33ce6f6bd..2a39b9bf899 100644 --- a/admin/post-types/writepanels/writepanel-product_data.php +++ b/admin/post-types/writepanels/writepanel-product_data.php @@ -749,12 +749,13 @@ function woocommerce_process_product_meta( $post_id, $post ) { if ( isset( $attribute_values[ $i ] ) ) { - // Format values (posted values are slugs) + // Select based attributes - Format values (posted values are slugs) if ( is_array( $attribute_values[ $i ] ) ) { $values = array_map( 'sanitize_title', $attribute_values[ $i ] ); + + // Text based attributes - Posted values are term names - don't change to slugs } else { - // Text based, separate by pipe - $values = array_map( 'sanitize_title', explode( '|', $attribute_values[ $i ] ) ); + $values = array_map( 'stripslashes', array_map( 'strip_tags', explode( '|', $attribute_values[ $i ] ) ) ); } // Remove empty items in the array diff --git a/readme.txt b/readme.txt index 08bdc31b6d0..bf99ba8663d 100644 --- a/readme.txt +++ b/readme.txt @@ -168,7 +168,9 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc = X = * Feature - Related products shortcode. * Tweak - Support for the city field in shipping calc (filterable). +* Fix - Updated shareyourcart SDK. * Fix - moved woocommerce_get_filename_from_url to core-functions as it is required in admin too. +* Fix - checkmark after adding to cart multiple times. = 2.0.7 - 12/04/2013 = * Feature - Option for GA _setDomainName. diff --git a/woocommerce-ajax.php b/woocommerce-ajax.php index b5c780b43a9..d58755108b8 100644 --- a/woocommerce-ajax.php +++ b/woocommerce-ajax.php @@ -442,12 +442,13 @@ function woocommerce_save_attributes() { if ( isset( $attribute_values[ $i ] ) ) { - // Format values (slug format) + // Select based attributes - Format values (posted values are slugs) if ( is_array( $attribute_values[ $i ] ) ) { - $values = array_map( 'sanitize_title', array_map( 'stripslashes', $attribute_values[ $i ] ) ); + $values = array_map( 'sanitize_title', $attribute_values[ $i ] ); + + // Text based attributes - Posted values are term names - don't change to slugs } else { - // Text based, separate by pipe - $values = array_map( 'sanitize_title', array_map( 'stripslashes', explode( '|', $attribute_values[ $i ] ) ) ); + $values = array_map( 'stripslashes', array_map( 'strip_tags', explode( '|', $attribute_values[ $i ] ) ) ); } // Remove empty items in the array