Use wc_clean to sanitize fee title in legacy apis

This will bring legacy APIs in line with the new REST API, where the
order item names are sanitized using wc_clean and fix the
backwards-incompatible change of using sanitize_title.
This commit is contained in:
Illimar Tambek 2017-03-09 11:00:35 +02:00
parent 8e81a7e4e0
commit 21a54b93d8
2 changed files with 4 additions and 4 deletions

View File

@ -1070,7 +1070,7 @@ class WC_API_Orders extends WC_API_Resource {
$item = new WC_Order_Item_Fee();
$item->set_order_id( $order->get_id() );
$item->set_name( sanitize_title( $fee['title'] ) );
$item->set_name( wc_clean( $fee['title'] ) );
$item->set_total( isset( $fee['total'] ) ? floatval( $fee['total'] ) : 0 );
// if taxable, tax class and total are required
@ -1102,7 +1102,7 @@ class WC_API_Orders extends WC_API_Resource {
$item = new WC_Order_Item_Fee( $fee['id'] );
if ( isset( $fee['title'] ) ) {
$item->set_name( sanitize_title( $fee['title'] ) );
$item->set_name( wc_clean( $fee['title'] ) );
}
if ( isset( $fee['tax_class'] ) ) {

View File

@ -1120,7 +1120,7 @@ class WC_API_Orders extends WC_API_Resource {
$item = new WC_Order_Item_Fee();
$item->set_order_id( $order->get_id() );
$item->set_name( sanitize_title( $fee['title'] ) );
$item->set_name( wc_clean( $fee['title'] ) );
$item->set_total( isset( $fee['total'] ) ? floatval( $fee['total'] ) : 0 );
// if taxable, tax class and total are required
@ -1152,7 +1152,7 @@ class WC_API_Orders extends WC_API_Resource {
$item = new WC_Order_Item_Fee( $fee['id'] );
if ( isset( $fee['title'] ) ) {
$item->set_name( sanitize_title( $fee['title'] ) );
$item->set_name( wc_clean( $fee['title'] ) );
}
if ( isset( $fee['tax_class'] ) ) {