changed dynamic variation description to allow limited HTML and some sanitized tweaks

This commit is contained in:
roykho 2015-05-28 14:31:45 -07:00
parent e51eae80c6
commit 54b0a0ca54
4 changed files with 5 additions and 5 deletions

View File

@ -46,8 +46,8 @@
selected_index--;
if ( all_variations[ selected_index ].hasOwnProperty( 'variation_description' ) ) {
var_description_html = '<p class="woocommerce-variation-description woocommerce-variation-description-' +
all_variations[ selected_index ].variation_id + '">' + all_variations[ selected_index ].variation_description + '</p>';
var_description_html = '<div class="woocommerce-variation-description woocommerce-variation-description-' +
all_variations[ selected_index ].variation_id + '">' + all_variations[ selected_index ].variation_description + '</div>';
return var_description_html;
}

View File

@ -1494,7 +1494,7 @@ class WC_Meta_Box_Product_Data {
update_post_meta( $variation_id, '_downloadable_files', '' );
}
update_post_meta( $variation_id, '_variation_description', sanitize_text_field( $variable_description[ $i ] ) );
update_post_meta( $variation_id, '_variation_description', wp_kses_post( $variable_description[ $i ] ) );
// Save shipping class
$variable_shipping_class[ $i ] = ! empty( $variable_shipping_class[ $i ] ) ? (int) $variable_shipping_class[ $i ] : '';

View File

@ -189,7 +189,7 @@ extract( $variation_data );
<p class="form-row form-row-full">
<label><?php _e( 'Variation Description:', 'woocommerce' ); ?></label>
<textarea name="variable_description[<?php echo $loop; ?>]" rows="3" style="width:100%;"><?php echo isset( $variation_data['_variation_description'] ) ? sanitize_text_field( $variation_data['_variation_description'] ) : ''; ?></textarea>
<textarea name="variable_description[<?php echo $loop; ?>]" rows="3" style="width:100%;"><?php echo isset( $variation_data['_variation_description'] ) ? wp_kses_post( $variation_data['_variation_description'] ) : ''; ?></textarea>
</p>
</div>
<div class="show_if_variation_downloadable" style="display: none;">

View File

@ -668,6 +668,6 @@ class WC_Product_Variation extends WC_Product {
* @return string
*/
public function get_variation_description() {
return get_post_meta( $this->variation_id, '_variation_description', true );
return wpautop( wp_kses_post( get_post_meta( $this->variation_id, '_variation_description', true ) ) );
}
}