Use wc_check_utf8 function
This commit is contained in:
parent
dfad1306de
commit
91d2411aa9
|
@ -208,7 +208,7 @@ function wc_save_order_items( $order_id, $items ) {
|
|||
$item_data = array();
|
||||
|
||||
foreach ( $data_keys as $key => $default ) {
|
||||
$item_data[ $key ] = isset( $items[ $key ][ $item_id ] ) ? wc_clean( wp_unslash( $items[ $key ][ $item_id ] ) ) : $default;
|
||||
$item_data[ $key ] = isset( $items[ $key ][ $item_id ] ) ? wc_check_invalid_utf8( wp_unslash( $items[ $key ][ $item_id ] ) ) : $default;
|
||||
}
|
||||
|
||||
if ( '0' === $item_data['order_item_qty'] ) {
|
||||
|
|
|
@ -377,6 +377,20 @@ function wc_clean( $var ) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wp_check_invalid_utf8 with recursive array support.
|
||||
*
|
||||
* @param string|array $var Data to sanitize.
|
||||
* @return string|array
|
||||
*/
|
||||
function wc_check_invalid_utf8( $var ) {
|
||||
if ( is_array( $var ) ) {
|
||||
return array_map( 'wc_check_invalid_utf8', $var );
|
||||
} else {
|
||||
return wp_check_invalid_utf8( $var );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run wc_clean over posted textarea but maintain line breaks.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue